Re: [FFmpeg-devel] [PATCH 3/6] avcodec/ffwavesynth: use uint32_t to compute difference, it is enough
Nicolas George (12019-07-19): > Sorry, I thought I missed the spot and you already applied it. > > This patch could be merged with this one: > > avcodec/ffwavesynth: More correct cast in wavesynth_seek() > > but it is not very important. > > As for: > > avcodec/ffwavesynth: Fix backward lcg_seek() > avcodec/ffwavesynth: Simplify lcg_seek(), avoid negative case > > If you checked they generate the same sequence, then ok and thanks. If > not, then I can do the testing tomorrow. I tested with the following testing code, and the new version behaves perfectly. I do not believe this requires including the test program as part of the code base. It would have been if somebody had not had the bad idea of removing the possibility of having just "#if TEST \n int main() {...}" for quick tests. Regards, -- Nicolas George #include #include #include #include #define N 1000 static uint32_t val[N]; int main(void) { uint32_t state = 'P' | ('I' << 8) | ('N' << 16) | ('K' << 24); unsigned i, pos, target; int64_t off; for (i = 0; i < N; i++) { val[i] = state; state = lcg_next(&state); } printf("final state = %08x\n", (unsigned)state); pos = 0; state = val[pos]; for (i = 0; i < 1; i++) { target = val[pos] % N; off = (int64_t)target - (int64_t)pos; lcg_seek(&state, off); printf("seeking from %10d to %10d by %10"PRId64": %08x vs %08x\n", pos, target, off, (unsigned)state, (unsigned)val[target]); if (state != val[target]) exit(1); pos = target; } return 0; } signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/6] avcodec/ffwavesynth: use uint32_t to compute difference, it is enough
Michael Niedermayer (12019-07-08): > On Sat, Jun 22, 2019 at 01:29:33AM +0200, Michael Niedermayer wrote: > > Fixes: signed integer overflow: 6494225984479297536 - -6043795377581187040 > > cannot be represented in type 'long' > > Fixes: > > 15285/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFWAVESYNTH_fuzzer-5632780307791872 > > > > Found-by: continuous fuzzing process > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > > Signed-off-by: Michael Niedermayer > > --- > > libavcodec/ffwavesynth.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > will apply Sorry, I thought I missed the spot and you already applied it. This patch could be merged with this one: avcodec/ffwavesynth: More correct cast in wavesynth_seek() but it is not very important. As for: avcodec/ffwavesynth: Fix backward lcg_seek() avcodec/ffwavesynth: Simplify lcg_seek(), avoid negative case If you checked they generate the same sequence, then ok and thanks. If not, then I can do the testing tomorrow. Regards, -- Nicolas George signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/6] avcodec/ffwavesynth: use uint32_t to compute difference, it is enough
On Sat, Jun 22, 2019 at 01:29:33AM +0200, Michael Niedermayer wrote: > Fixes: signed integer overflow: 6494225984479297536 - -6043795377581187040 > cannot be represented in type 'long' > Fixes: > 15285/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFWAVESYNTH_fuzzer-5632780307791872 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/ffwavesynth.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB When you are offended at any man's fault, turn to yourself and study your own failings. Then you will forget your anger. -- Epictetus signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 3/6] avcodec/ffwavesynth: use uint32_t to compute difference, it is enough
Fixes: signed integer overflow: 6494225984479297536 - -6043795377581187040 cannot be represented in type 'long' Fixes: 15285/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFWAVESYNTH_fuzzer-5632780307791872 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/ffwavesynth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/ffwavesynth.c b/libavcodec/ffwavesynth.c index b2cc7c8fc1..793eada7a5 100644 --- a/libavcodec/ffwavesynth.c +++ b/libavcodec/ffwavesynth.c @@ -215,7 +215,7 @@ static void wavesynth_seek(struct wavesynth_context *ws, int64_t ts) ws->next_inter = i; ws->next_ts = i < ws->nb_inter ? ws->inter[i].ts_start : INF_TS; *last = -1; -lcg_seek(&ws->dither_state, ts - ws->cur_ts); +lcg_seek(&ws->dither_state, (uint32_t)ts - ws->cur_ts); if (ws->pink_need) { int64_t pink_ts_cur = (ws->cur_ts + PINK_UNIT - 1) & ~(PINK_UNIT - 1); int64_t pink_ts_next = ts & ~(PINK_UNIT - 1); -- 2.22.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".