From: Michael Niedermayer <michael@niedermayer.cc>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH 2/3] avcodec/iff: dont add into unused pointers
Date: Sat, 16 Mar 2024 22:26:35 +0100
Message-ID: <20240316212636.2642-2-michael@niedermayer.cc> (raw)
In-Reply-To: <20240316212636.2642-1-michael@niedermayer.cc>
Fixes: overflowing pointers
Fixes: 66444/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-4812862400823296
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
libavcodec/iff.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/libavcodec/iff.c b/libavcodec/iff.c
index faf4e21c42..dcca7018c4 100644
--- a/libavcodec/iff.c
+++ b/libavcodec/iff.c
@@ -1661,7 +1661,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
uint8_t *row = &frame->data[0][y * frame->linesize[0]];
memset(row, 0, avctx->width);
for (plane = 0; plane < s->bpp; plane++) {
- buf += decode_byterun(s->planebuf, s->planesize, gb);
+ decode_byterun(s->planebuf, s->planesize, gb);
if (avctx->codec_tag == MKTAG('A', 'N', 'I', 'M')) {
memcpy(video, s->planebuf, s->planesize);
video += s->planesize;
@@ -1674,7 +1674,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
uint8_t *row = &frame->data[0][y * frame->linesize[0]];
memset(s->mask_buf, 0, avctx->width * sizeof(uint32_t));
for (plane = 0; plane < s->bpp; plane++) {
- buf += decode_byterun(s->planebuf, s->planesize, gb);
+ decode_byterun(s->planebuf, s->planesize, gb);
decodeplane32(s->mask_buf, s->planebuf, s->planesize, plane);
}
lookup_pal_indicies((uint32_t *)row, s->mask_buf, s->mask_palbuf, avctx->width);
@@ -1685,7 +1685,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
uint8_t *row = &frame->data[0][y * frame->linesize[0]];
memset(s->ham_buf, 0, s->planesize * 8);
for (plane = 0; plane < s->bpp; plane++) {
- buf += decode_byterun(s->planebuf, s->planesize, gb);
+ decode_byterun(s->planebuf, s->planesize, gb);
if (avctx->codec_tag == MKTAG('A', 'N', 'I', 'M')) {
memcpy(video, s->planebuf, s->planesize);
video += s->planesize;
@@ -1699,7 +1699,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
uint8_t *row = &frame->data[0][y * frame->linesize[0]];
memset(row, 0, avctx->width << 2);
for (plane = 0; plane < s->bpp; plane++) {
- buf += decode_byterun(s->planebuf, s->planesize, gb);
+ decode_byterun(s->planebuf, s->planesize, gb);
decodeplane32((uint32_t *)row, s->planebuf, s->planesize, plane);
}
}
@@ -1708,12 +1708,12 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
if (avctx->pix_fmt == AV_PIX_FMT_PAL8 || avctx->pix_fmt == AV_PIX_FMT_GRAY8) {
for (y = 0; y < avctx->height; y++) {
uint8_t *row = &frame->data[0][y * frame->linesize[0]];
- buf += decode_byterun(row, avctx->width, gb);
+ decode_byterun(row, avctx->width, gb);
}
} else if (s->ham) { // IFF-PBM: HAM to AV_PIX_FMT_BGR32
for (y = 0; y < avctx->height; y++) {
uint8_t *row = &frame->data[0][y * frame->linesize[0]];
- buf += decode_byterun(s->ham_buf, avctx->width, gb);
+ decode_byterun(s->ham_buf, avctx->width, gb);
decode_ham_plane32((uint32_t *)row, s->ham_buf, s->ham_palbuf, s->planesize);
}
} else
--
2.17.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2024-03-16 21:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-16 21:26 [FFmpeg-devel] [PATCH 1/3] tools/target_dem_fuzzer: add libavformat/demux.h Michael Niedermayer
2024-03-16 21:26 ` Michael Niedermayer [this message]
2024-04-01 17:01 ` [FFmpeg-devel] [PATCH 2/3] avcodec/iff: dont add into unused pointers Michael Niedermayer
2024-03-16 21:26 ` [FFmpeg-devel] [PATCH 3/3] tools/target_dec_fuzzer: adjust threshold for AV_CODEC_ID_IFF_ILBM Michael Niedermayer
2024-03-17 15:12 ` [FFmpeg-devel] [PATCH 1/3] tools/target_dem_fuzzer: add libavformat/demux.h Andreas Rheinhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240316212636.2642-2-michael@niedermayer.cc \
--to=michael@niedermayer.cc \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git