avformat/lafdec: Check if all data was read

Fixes: OOM
Fixes: 54572/clusterfuzz-testcase-minimized-ffmpeg_dem_LAF_fuzzer-4974038870523904

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
release/6.0
Michael Niedermayer 2 years ago
parent 35871c26d2
commit ad95d9c855
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64
  1. 3
      libavformat/lafdec.c

@ -21,6 +21,7 @@
#include "libavutil/intreadwrite.h" #include "libavutil/intreadwrite.h"
#include "avformat.h" #include "avformat.h"
#include "avio_internal.h"
#include "internal.h" #include "internal.h"
#define MAX_STREAMS 4096 #define MAX_STREAMS 4096
@ -205,7 +206,7 @@ again:
s->nb_stored = st_count; s->nb_stored = st_count;
if (!st_count) if (!st_count)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
ret = avio_read(pb, s->data, st_count * st->codecpar->sample_rate * bpp); ret = ffio_read_size(pb, s->data, st_count * st->codecpar->sample_rate * bpp);
if (ret < 0) if (ret < 0)
return ret; return ret;
} }

Loading…
Cancel
Save