[FFmpeg-devel] [PATCH 5/6] avformat/dhav: Check ffio_ensure_seekback()

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Wed May 22 08:08:33 EEST 2024


Fixes Coverity issue #1492324.

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

diff --git a/libavformat/dhav.c b/libavformat/dhav.c
index 303fb42bed..8e08274e68 100644
--- a/libavformat/dhav.c
+++ b/libavformat/dhav.c
@@ -273,8 +273,11 @@ static int dhav_read_header(AVFormatContext *s)
 {
     DHAVContext *dhav = s->priv_data;
     uint8_t signature[5];
+    int ret = ffio_ensure_seekback(s->pb, 5);
+
+    if (ret < 0)
+        return ret;
 
-    ffio_ensure_seekback(s->pb, 5);
     avio_read(s->pb, signature, sizeof(signature));
     if (!memcmp(signature, "DAHUA", 5)) {
         avio_skip(s->pb, 0x400 - 5);
-- 
2.40.1



More information about the ffmpeg-devel mailing list