diff mbox series

[FFmpeg-devel,6/6] avformat/dhav: Check amount read

Message ID GV1P250MB07377C7D6262EA35B7F144A38FEB2@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit d8cad01805be74783344d69e81c9c31f49ba4d92
Headers show
Series [FFmpeg-devel,1/6] avformat/oggdec: Check ffio_ensure_seekback() | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished

Commit Message

Andreas Rheinhardt May 22, 2024, 5:08 a.m. UTC
Prevents potential use of uninitialized data in the following
memcmp().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/dhav.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavformat/dhav.c b/libavformat/dhav.c
index 8e08274e68..b2ead99609 100644
--- a/libavformat/dhav.c
+++ b/libavformat/dhav.c
@@ -278,7 +278,9 @@  static int dhav_read_header(AVFormatContext *s)
     if (ret < 0)
         return ret;
 
-    avio_read(s->pb, signature, sizeof(signature));
+    ret = ffio_read_size(s->pb, signature, sizeof(signature));
+    if (ret < 0)
+        return ret;
     if (!memcmp(signature, "DAHUA", 5)) {
         avio_skip(s->pb, 0x400 - 5);
         dhav->last_good_pos = avio_tell(s->pb);