[FFmpeg-cvslog] avcodec/ffwavesynth: Simplify lcg_seek(), avoid negative case
ffmpeg | branch: release/4.1 | Michael Niedermayer | Fri Jun 21 22:41:25 2019 +0200| [73885bf3e19651b2316eac6690167095039603b2] | committer: Michael Niedermayer avcodec/ffwavesynth: Simplify lcg_seek(), avoid negative case Fixes: negation of -9223372036854775808 cannot be represented in type 'int64_t' (aka 'long'); cast to an unsigned type to negate this value to itself Fixes: 15289/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFWAVESYNTH_fuzzer-5709034499342336 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 8c022099351c04ae21e0b8696ea71a690ed03cd2) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=73885bf3e19651b2316eac6690167095039603b2 --- libavcodec/ffwavesynth.c | 12 +++- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/libavcodec/ffwavesynth.c b/libavcodec/ffwavesynth.c index cf8c780f3e..b2cc7c8fc1 100644 --- a/libavcodec/ffwavesynth.c +++ b/libavcodec/ffwavesynth.c @@ -113,18 +113,12 @@ static uint32_t lcg_next(uint32_t *s) return *s; } -static void lcg_seek(uint32_t *s, int64_t dt) +static void lcg_seek(uint32_t *s, uint32_t dt) { uint32_t a, c, t = *s; -if (dt >= 0) { -a = LCG_A; -c = LCG_C; -} else { /* coefficients for a step backward */ -a = LCG_AI; -c = (uint32_t)(-LCG_AI * LCG_C); -dt = -dt; -} +a = LCG_A; +c = LCG_C; while (dt) { if (dt & 1) t = a * t + c; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/ffwavesynth: Simplify lcg_seek(), avoid negative case
ffmpeg | branch: master | Michael Niedermayer | Fri Jun 21 22:41:25 2019 +0200| [8c022099351c04ae21e0b8696ea71a690ed03cd2] | committer: Michael Niedermayer avcodec/ffwavesynth: Simplify lcg_seek(), avoid negative case Fixes: negation of -9223372036854775808 cannot be represented in type 'int64_t' (aka 'long'); cast to an unsigned type to negate this value to itself Fixes: 15289/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFWAVESYNTH_fuzzer-5709034499342336 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8c022099351c04ae21e0b8696ea71a690ed03cd2 --- libavcodec/ffwavesynth.c | 12 +++- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/libavcodec/ffwavesynth.c b/libavcodec/ffwavesynth.c index cf8c780f3e..b2cc7c8fc1 100644 --- a/libavcodec/ffwavesynth.c +++ b/libavcodec/ffwavesynth.c @@ -113,18 +113,12 @@ static uint32_t lcg_next(uint32_t *s) return *s; } -static void lcg_seek(uint32_t *s, int64_t dt) +static void lcg_seek(uint32_t *s, uint32_t dt) { uint32_t a, c, t = *s; -if (dt >= 0) { -a = LCG_A; -c = LCG_C; -} else { /* coefficients for a step backward */ -a = LCG_AI; -c = (uint32_t)(-LCG_AI * LCG_C); -dt = -dt; -} +a = LCG_A; +c = LCG_C; while (dt) { if (dt & 1) t = a * t + c; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".