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 a8f7636823 avcodec/xan: use only the bytes xan_unpack() wrote as image
data
a8f7636823 is described below
commit a8f76368232e3d3d91ae9590a3ecf98bc35a3824
Author: Michael Niedermayer <[email protected]>
AuthorDate: Tue Sep 22 00:50:26 2026 +0200
Commit: michaelni <[email protected]>
CommitDate: Mon Sep 28 03:32:05 2026 +0000
avcodec/xan: use only the bytes xan_unpack() wrote as image data
Fixes: use of uninitialized memory
Fixes: 1x2fnPjXJ7Vn/xan_wc3_uninit_buffer2.mve
Fixes: 1x2fnPjXJ7Vn
Reporter ID:
swarm-Heap-info-leak-via-partially-filled-buffer2-after-xan_unpack-d3f824
Found-by: zhang xingxing <[email protected]>
Signed-off-by: Michael Niedermayer <[email protected]>
---
libavcodec/xan.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/libavcodec/xan.c b/libavcodec/xan.c
index 56675dbbb1..416e33c420 100644
--- a/libavcodec/xan.c
+++ b/libavcodec/xan.c
@@ -149,9 +149,10 @@ static int xan_huffman_decode(uint8_t *dest, int dest_len,
* unpack simple compression
*
* @param dest destination buffer of dest_len, must be padded with at least
130 bytes
+ * @return number of bytes written to dest
*/
-static void xan_unpack(uint8_t *dest, int dest_len,
- const uint8_t *src, int src_len)
+static int xan_unpack(uint8_t *dest, int dest_len,
+ const uint8_t *src, int src_len)
{
uint8_t opcode;
int size;
@@ -185,7 +186,7 @@ static void xan_unpack(uint8_t *dest, int dest_len,
if (dest_end - dest < size + size2 ||
dest + size - dest_org < back ||
bytestream2_get_bytes_left(&ctx) < size)
- return;
+ break;
bytestream2_get_buffer(&ctx, dest, size);
dest += size;
av_memcpy_backptr(dest, back, size2);
@@ -195,13 +196,14 @@ static void xan_unpack(uint8_t *dest, int dest_len,
size = finish ? opcode & 3 : ((opcode & 0x1f) << 2) + 4;
if (dest_end - dest < size || bytestream2_get_bytes_left(&ctx) <
size)
- return;
+ break;
bytestream2_get_buffer(&ctx, dest, size);
dest += size;
if (finish)
- return;
+ break;
}
}
+ return dest - dest_org;
}
static inline void xan_wc3_output_pixel_run(XanContext *s, AVFrame *frame,
@@ -342,9 +344,8 @@ static int xan_wc3_decode_frame(XanContext *s, AVFrame
*frame)
opcode_buffer_end = opcode_buffer + ret;
if (imagedata_segment[0] == 2) {
- xan_unpack(s->buffer2, s->buffer2_size,
- &imagedata_segment[1], s->size - imagedata_offset - 1);
- imagedata_size = s->buffer2_size;
+ imagedata_size = xan_unpack(s->buffer2, s->buffer2_size,
+ &imagedata_segment[1], s->size -
imagedata_offset - 1);
} else {
imagedata_size = s->size - imagedata_offset - 1;
imagedata_buffer = &imagedata_segment[1];
--
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]