* [FFmpeg-devel] [PATCH 1/3] avcodec/huffyuvdec: avoid undefined behavior with get_vlc2() failure
@ 2023-06-19 23:04 Michael Niedermayer
2023-06-19 23:04 ` [FFmpeg-devel] [PATCH 2/3] tools/target_dec_fuzzer: Adjust threshold for speex Michael Niedermayer
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Michael Niedermayer @ 2023-06-19 23:04 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Fixes: left shift of negative value -1
Fixes: 59889/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HUFFYUV_fuzzer-5472742275940352
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
libavcodec/huffyuvdec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c
index 8ba67bbdeb..1a7690da94 100644
--- a/libavcodec/huffyuvdec.c
+++ b/libavcodec/huffyuvdec.c
@@ -755,7 +755,7 @@ static void decode_plane_bitstream(HYuvDecContext *s, int width, int plane)
}
}
if( width&1 && get_bits_left(&s->gb)>0 ) {
- int dst = get_vlc2(&s->gb, s->vlc[plane].table, VLC_BITS, 3)<<2;
+ int dst = (unsigned)get_vlc2(&s->gb, s->vlc[plane].table, VLC_BITS, 3)<<2;
s->temp16[0][width-1] = dst + get_bits(&s->gb, 2);
}
}
--
2.17.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 8+ messages in thread
* [FFmpeg-devel] [PATCH 2/3] tools/target_dec_fuzzer: Adjust threshold for speex
2023-06-19 23:04 [FFmpeg-devel] [PATCH 1/3] avcodec/huffyuvdec: avoid undefined behavior with get_vlc2() failure Michael Niedermayer
@ 2023-06-19 23:04 ` Michael Niedermayer
2023-06-23 0:03 ` Michael Niedermayer
2023-06-19 23:04 ` [FFmpeg-devel] [PATCH 3/3] avutil/softfloat: fix av_sincos_sf() Michael Niedermayer
2023-06-19 23:05 ` [FFmpeg-devel] [PATCH 1/3] avcodec/huffyuvdec: avoid undefined behavior with get_vlc2() failure Paul B Mahol
2 siblings, 1 reply; 8+ messages in thread
From: Michael Niedermayer @ 2023-06-19 23:04 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Fixes: Timeout
Fixes: 59731/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SPEEX_fuzzer-4809436670328832
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
tools/target_dec_fuzzer.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
index 42de479829..165951dc9d 100644
--- a/tools/target_dec_fuzzer.c
+++ b/tools/target_dec_fuzzer.c
@@ -278,6 +278,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
case AV_CODEC_ID_SCPR: maxpixels /= 32; break;
case AV_CODEC_ID_SCREENPRESSO:maxpixels /= 64; break;
case AV_CODEC_ID_SIMBIOSIS_IMX:maxpixels /= 16384; break;
+ case AV_CODEC_ID_SPEEX: maxsamples /= 128; break;
case AV_CODEC_ID_SMACKAUDIO: maxsamples /= 4096; break;
case AV_CODEC_ID_SMACKVIDEO: maxpixels /= 64; break;
case AV_CODEC_ID_SNOW: maxpixels /= 128; break;
--
2.17.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 8+ messages in thread
* [FFmpeg-devel] [PATCH 3/3] avutil/softfloat: fix av_sincos_sf()
2023-06-19 23:04 [FFmpeg-devel] [PATCH 1/3] avcodec/huffyuvdec: avoid undefined behavior with get_vlc2() failure Michael Niedermayer
2023-06-19 23:04 ` [FFmpeg-devel] [PATCH 2/3] tools/target_dec_fuzzer: Adjust threshold for speex Michael Niedermayer
@ 2023-06-19 23:04 ` Michael Niedermayer
2023-06-23 0:04 ` Michael Niedermayer
2023-06-19 23:05 ` [FFmpeg-devel] [PATCH 1/3] avcodec/huffyuvdec: avoid undefined behavior with get_vlc2() failure Paul B Mahol
2 siblings, 1 reply; 8+ messages in thread
From: Michael Niedermayer @ 2023-06-19 23:04 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
libavutil/softfloat.h | 2 +-
libavutil/tests/softfloat.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavutil/softfloat.h b/libavutil/softfloat.h
index a651406f74..1520027ddc 100644
--- a/libavutil/softfloat.h
+++ b/libavutil/softfloat.h
@@ -281,7 +281,7 @@ static av_unused void av_sincos_sf(int a, int *s, int *c)
(int64_t)av_sintbl_4_sf[(idx & 0x1f) + 1] * (a & 0x7ff) +
0x400) >> 11);
- *c = (int)(((int64_t)cv * ct + (int64_t)sv * st + 0x20000000) >> 30);
+ *c = (int)(((int64_t)cv * ct - (int64_t)sv * st + 0x20000000) >> 30);
*s = (int)(((int64_t)cv * st + (int64_t)sv * ct + 0x20000000) >> 30);
}
diff --git a/libavutil/tests/softfloat.c b/libavutil/tests/softfloat.c
index c06de44933..a2e628fe81 100644
--- a/libavutil/tests/softfloat.c
+++ b/libavutil/tests/softfloat.c
@@ -148,7 +148,7 @@ int main(void){
av_sincos_sf(i*(1ULL<<32)/36/4, &s, &c);
errs = (double)s/ (1<<30) - sin(i*M_PI/36);
errc = (double)c/ (1<<30) - cos(i*M_PI/36);
- if (fabs(errs) > 0.00000002 || fabs(errc) >0.001) {
+ if (fabs(errs) > 0.000000004 || fabs(errc) >0.000000004) {
printf("sincos FAIL %d %f %f %f %f\n", i, (float)s/ (1<<30), (float)c/ (1<<30), sin(i*M_PI/36), cos(i*M_PI/36));
}
--
2.17.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/3] avcodec/huffyuvdec: avoid undefined behavior with get_vlc2() failure
2023-06-19 23:04 [FFmpeg-devel] [PATCH 1/3] avcodec/huffyuvdec: avoid undefined behavior with get_vlc2() failure Michael Niedermayer
2023-06-19 23:04 ` [FFmpeg-devel] [PATCH 2/3] tools/target_dec_fuzzer: Adjust threshold for speex Michael Niedermayer
2023-06-19 23:04 ` [FFmpeg-devel] [PATCH 3/3] avutil/softfloat: fix av_sincos_sf() Michael Niedermayer
@ 2023-06-19 23:05 ` Paul B Mahol
2023-06-19 23:36 ` Michael Niedermayer
2 siblings, 1 reply; 8+ messages in thread
From: Paul B Mahol @ 2023-06-19 23:05 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Shouldnt it error out instead?
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/3] avcodec/huffyuvdec: avoid undefined behavior with get_vlc2() failure
2023-06-19 23:05 ` [FFmpeg-devel] [PATCH 1/3] avcodec/huffyuvdec: avoid undefined behavior with get_vlc2() failure Paul B Mahol
@ 2023-06-19 23:36 ` Michael Niedermayer
2023-09-14 19:49 ` Michael Niedermayer
0 siblings, 1 reply; 8+ messages in thread
From: Michael Niedermayer @ 2023-06-19 23:36 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 572 bytes --]
On Tue, Jun 20, 2023 at 01:05:45AM +0200, Paul B Mahol wrote:
> Shouldnt it error out instead?
yes but that would make it slower. Also i think real files (not fuzzeed files)
would use vlc tables that have no "holes" that can generate invalid returns
so the check might on top of being slow also be not that useful.
But i surely can add a check if thats what people prefer?
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Republics decline into democracies and democracies degenerate into
despotisms. -- Aristotle
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FFmpeg-devel] [PATCH 2/3] tools/target_dec_fuzzer: Adjust threshold for speex
2023-06-19 23:04 ` [FFmpeg-devel] [PATCH 2/3] tools/target_dec_fuzzer: Adjust threshold for speex Michael Niedermayer
@ 2023-06-23 0:03 ` Michael Niedermayer
0 siblings, 0 replies; 8+ messages in thread
From: Michael Niedermayer @ 2023-06-23 0:03 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 666 bytes --]
On Tue, Jun 20, 2023 at 01:04:23AM +0200, Michael Niedermayer wrote:
> Fixes: Timeout
> Fixes: 59731/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SPEEX_fuzzer-4809436670328832
>
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
> tools/target_dec_fuzzer.c | 1 +
> 1 file changed, 1 insertion(+)
will apply
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FFmpeg-devel] [PATCH 3/3] avutil/softfloat: fix av_sincos_sf()
2023-06-19 23:04 ` [FFmpeg-devel] [PATCH 3/3] avutil/softfloat: fix av_sincos_sf() Michael Niedermayer
@ 2023-06-23 0:04 ` Michael Niedermayer
0 siblings, 0 replies; 8+ messages in thread
From: Michael Niedermayer @ 2023-06-23 0:04 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 460 bytes --]
On Tue, Jun 20, 2023 at 01:04:24AM +0200, Michael Niedermayer wrote:
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
> libavutil/softfloat.h | 2 +-
> libavutil/tests/softfloat.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
will apply
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/3] avcodec/huffyuvdec: avoid undefined behavior with get_vlc2() failure
2023-06-19 23:36 ` Michael Niedermayer
@ 2023-09-14 19:49 ` Michael Niedermayer
0 siblings, 0 replies; 8+ messages in thread
From: Michael Niedermayer @ 2023-09-14 19:49 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 724 bytes --]
On Tue, Jun 20, 2023 at 01:36:40AM +0200, Michael Niedermayer wrote:
> On Tue, Jun 20, 2023 at 01:05:45AM +0200, Paul B Mahol wrote:
> > Shouldnt it error out instead?
>
> yes but that would make it slower. Also i think real files (not fuzzeed files)
> would use vlc tables that have no "holes" that can generate invalid returns
> so the check might on top of being slow also be not that useful.
> But i surely can add a check if thats what people prefer?
no reply so ill apply the original patch, so this is fixed
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-09-14 19:50 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-19 23:04 [FFmpeg-devel] [PATCH 1/3] avcodec/huffyuvdec: avoid undefined behavior with get_vlc2() failure Michael Niedermayer
2023-06-19 23:04 ` [FFmpeg-devel] [PATCH 2/3] tools/target_dec_fuzzer: Adjust threshold for speex Michael Niedermayer
2023-06-23 0:03 ` Michael Niedermayer
2023-06-19 23:04 ` [FFmpeg-devel] [PATCH 3/3] avutil/softfloat: fix av_sincos_sf() Michael Niedermayer
2023-06-23 0:04 ` Michael Niedermayer
2023-06-19 23:05 ` [FFmpeg-devel] [PATCH 1/3] avcodec/huffyuvdec: avoid undefined behavior with get_vlc2() failure Paul B Mahol
2023-06-19 23:36 ` Michael Niedermayer
2023-09-14 19:49 ` Michael Niedermayer
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git