diff mbox series

[FFmpeg-devel,16/22] avformat/webpenc: Check filesize in trailer

Message ID 20240711233417.1896879-16-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,01/22] avformat/asfdec_o: Check size of index object | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer July 11, 2024, 11:34 p.m. UTC
not sure this is possible

Fixes: CID1604446 Overflowed constant

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/webpenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavformat/webpenc.c b/libavformat/webpenc.c
index 1c5b93e0abf..ce0d046aa94 100644
--- a/libavformat/webpenc.c
+++ b/libavformat/webpenc.c
@@ -190,7 +190,7 @@  static int webp_write_trailer(AVFormatContext *s)
 
         if (!ret) {
             filesize = avio_tell(s->pb);
-            if (avio_seek(s->pb, 4, SEEK_SET) == 4) {
+            if (filesize >= 8 && avio_seek(s->pb, 4, SEEK_SET) == 4) {
                 avio_wl32(s->pb, filesize - 8);
                 // Note: without the following, avio only writes 8 bytes to the file.
                 avio_seek(s->pb, filesize, SEEK_SET);