avformat/webpenc: Check filesize in trailer

not sure this is possible

Fixes: CID1604446 Overflowed constant

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 7734c583f7)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
release/7.0
Michael Niedermayer 6 months ago
parent 591680a0cf
commit 2248217d42
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64
  1. 2
      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);

Loading…
Cancel
Save