[FFmpeg-cvslog] avcodec/tiff: Assert init_get_bits8() success in unpack_gray()

Michael Niedermayer git at videolan.org
Tue May 28 04:51:09 EEST 2024


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Fri May 17 23:58:30 2024 +0200| [a287f17db22c0c85f0445a1d31139cc70e73205e] | committer: Michael Niedermayer

avcodec/tiff: Assert init_get_bits8() success in unpack_gray()

Helps: CID1441939 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a287f17db22c0c85f0445a1d31139cc70e73205e
---

 libavcodec/tiff.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 80f3757f1e..846d817cdc 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -457,7 +457,8 @@ static void unpack_gray(TiffContext *s, AVFrame *p,
     GetBitContext gb;
     uint16_t *dst = (uint16_t *)(p->data[0] + lnum * p->linesize[0]);
 
-    init_get_bits8(&gb, src, width);
+    int ret = init_get_bits8(&gb, src, width);
+    av_assert1(ret >= 0);
 
     for (int i = 0; i < s->width; i++) {
         dst[i] = get_bits(&gb, bpp);



More information about the ffmpeg-cvslog mailing list