mirror of
https://github.com/joel16/SDL2.git
synced 2024-12-14 06:48:33 +00:00
Fixed buffer overflows in resamplers.
I'm not confident this is a complete fix, but I'm not confident the current resamplers are really worth keeping at all, either. --HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404352
This commit is contained in:
parent
1411a41ebd
commit
4d3b6eafc8
File diff suppressed because it is too large
Load Diff
@ -537,15 +537,19 @@ ${sym}(SDL_AudioCVT * cvt, SDL_AudioFormat format)
|
||||
const int dstsize = cvt->len_cvt $lencvtop $multiple;
|
||||
EOF
|
||||
|
||||
my $endcomparison = '!=';
|
||||
|
||||
# Upsampling (growing the buffer) needs to work backwards, since we
|
||||
# overwrite the buffer as we go.
|
||||
if ($upsample) {
|
||||
$endcomparison = '>'; # dst > target
|
||||
print <<EOF;
|
||||
$fctype *dst = (($fctype *) (cvt->buf + dstsize)) - $channels;
|
||||
const $fctype *src = (($fctype *) (cvt->buf + cvt->len_cvt)) - $channels;
|
||||
const $fctype *target = ((const $fctype *) cvt->buf) - $channels;
|
||||
EOF
|
||||
} else {
|
||||
$endcomparison = '<'; # dst < target
|
||||
print <<EOF;
|
||||
$fctype *dst = ($fctype *) cvt->buf;
|
||||
const $fctype *src = ($fctype *) cvt->buf;
|
||||
@ -562,7 +566,7 @@ EOF
|
||||
}
|
||||
|
||||
print <<EOF;
|
||||
while (dst != target) {
|
||||
while (dst $endcomparison target) {
|
||||
EOF
|
||||
|
||||
for (my $i = 0; $i < $channels; $i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user