diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-08-30 23:14:32 +0200 |
---|---|---|
committer | Vittorio Giovara <vittorio.giovara@gmail.com> | 2013-11-28 15:37:55 +0100 |
commit | d1916d13e28b87f4b1b214231149e12e1d536b4b (patch) | |
tree | 23f0efa687daffcd9376e6fd7f11b089869b708d /libavcodec/dsputil.c | |
parent | 0673ede985a6560e7efb86dab1c58fb7f95ce587 (diff) | |
download | ffmpeg-d1916d13e28b87f4b1b214231149e12e1d536b4b.tar.gz |
dsputil/pngdsp: fix signed/unsigned type in end comparison
Fixes out of array accesses and integer overflows.
Diffstat (limited to 'libavcodec/dsputil.c')
-rw-r--r-- | libavcodec/dsputil.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c index fbdd5adbb1..e734fcd223 100644 --- a/libavcodec/dsputil.c +++ b/libavcodec/dsputil.c @@ -1742,7 +1742,7 @@ void ff_set_cmp(DSPContext* c, me_cmp_func *cmp, int type){ static void add_bytes_c(uint8_t *dst, uint8_t *src, int w){ long i; - for(i=0; i<=w-sizeof(long); i+=sizeof(long)){ + for (i = 0; i <= w - (int) sizeof(long); i += sizeof(long)) { long a = *(long*)(src+i); long b = *(long*)(dst+i); *(long*)(dst+i) = ((a&pb_7f) + (b&pb_7f)) ^ ((a^b)&pb_80); @@ -1767,7 +1767,7 @@ static void diff_bytes_c(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w){ } }else #endif - for(i=0; i<=w-sizeof(long); i+=sizeof(long)){ + for (i = 0; i <= w - (int) sizeof(long); i += sizeof(long)) { long a = *(long*)(src1+i); long b = *(long*)(src2+i); *(long*)(dst+i) = ((a|pb_80) - (b&pb_7f)) ^ ((a^b^pb_80)&pb_80); |