Mercurial > SDL_sound_CoreAudio
diff decoders/timidity/resample.c @ 254:a73c51c12452
Memory access fixes.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Mon, 11 Feb 2002 07:04:06 +0000 |
parents | 2d887640d300 |
children | f33471c47efe |
line wrap: on
line diff
--- a/decoders/timidity/resample.c Fri Feb 08 01:53:55 2002 +0000 +++ b/decoders/timidity/resample.c Mon Feb 11 07:04:06 2002 +0000 @@ -579,7 +579,12 @@ while (--count) { vptr = src + (ofs >> FRACTION_BITS); - v1 = *(vptr - 1); + /* + * Electric Fence to the rescue: Accessing *(vptr - 1) is not a + * good thing to do when vptr <= src. (TiMidity++ has a similar + * safe-guard here.) + */ + v1 = (vptr > src) ? *(vptr - 1) : 0; v2 = *vptr; v3 = *(vptr + 1); v4 = *(vptr + 2);