This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

The following commit(s) were added to refs/heads/master by this push:
     new f8f84348df avcodec/targa: reject truncated RLE packet payloads
f8f84348df is described below

commit f8f84348dfe1a80d38e7dbbcddcdd5d92a760dfd
Author:     Trithem90 <[email protected]>
AuthorDate: Tue Sep 1 21:44:45 2026 +0200
Commit:     Michael Niedermayer <[email protected]>
CommitDate: Tue Sep 29 17:46:34 2026 +0200

    avcodec/targa: reject truncated RLE packet payloads
    
    Fixes: 1j9froqh2wEw
    Regression since: 2ad405548b754751a33f7d8532604eae7fe4ce54
    Fixes: use-of-uninitialized-value
    Found-by: Trithem90 <[email protected]>
---
 libavcodec/targa.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/libavcodec/targa.c b/libavcodec/targa.c
index 7e016ea4af..10092ab3cb 100644
--- a/libavcodec/targa.c
+++ b/libavcodec/targa.c
@@ -69,7 +69,12 @@ static int targa_decode_rle(AVCodecContext *avctx, 
TargaContext *s,
         if (!type) {
             do {
                 int n  = FFMIN(count, w - x);
-                bytestream2_get_buffer(&s->gb, dst, n * depth);
+                if (bytestream2_get_bytes_left(&s->gb) < n * depth) {
+                    av_log(avctx, AV_LOG_ERROR,
+                           "Not enough data for raw RLE packet\n");
+                    return AVERROR_INVALIDDATA;
+                }
+                bytestream2_get_bufferu(&s->gb, dst, n * depth);
                 count -= n;
                 dst   += n * depth;
                 x     += n;
@@ -80,7 +85,11 @@ static int targa_decode_rle(AVCodecContext *avctx, 
TargaContext *s,
             } while (dst && count > 0);
         } else {
             uint8_t tmp[4];
-            bytestream2_get_buffer(&s->gb, tmp, depth);
+            if (bytestream2_get_buffer(&s->gb, tmp, depth) != depth) {
+                av_log(avctx, AV_LOG_ERROR,
+                       "Not enough data for RLE pixel\n");
+                return AVERROR_INVALIDDATA;
+            }
             do {
                 int n  = FFMIN(count, w - x);
                 count -= n;

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to