* [FFmpeg-devel] [PATCH 1/3] avcodec/bitstream_template: Basic documentation for read_vlc_multi()
@ 2023-10-22 15:39 Michael Niedermayer
2023-10-22 15:39 ` [FFmpeg-devel] [PATCH 2/3] avcodec/magicyuv: correct end of array check in multi VLC parsing Michael Niedermayer
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Michael Niedermayer @ 2023-10-22 15:39 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
libavcodec/bitstream_template.h | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/libavcodec/bitstream_template.h b/libavcodec/bitstream_template.h
index cf4aeff4feb..4f3d07275fb 100644
--- a/libavcodec/bitstream_template.h
+++ b/libavcodec/bitstream_template.h
@@ -520,7 +520,20 @@ static inline int BS_FUNC(read_vlc)(BSCTX *bc, const VLCElem *table,
return code;
}
-static inline int BS_FUNC(read_vlc_multi)(BSCTX *bc, uint8_t *dst,
+/**
+ * Parse a vlc / vlc_multi code.
+ * @param bits is the number of bits which will be read at once, must be
+ * identical to nb_bits in vlc_init()
+ * @param max_depth is the number of times bits bits must be read to completely
+ * read the longest vlc code
+ * = (max_vlc_length + bits - 1) / bits
+ * @param dst the parsed symbol(s) will be stored here. Up to 8 bytes are written
+ * @returns number of symbols parsed
+ * If the vlc code is invalid and max_depth=1, then no bits will be removed.
+ * If the vlc code is invalid and max_depth>1, then the number of bits removed
+ * is undefined.
+ */
+static inline int BS_FUNC(read_vlc_multi)(BSCTX *bc, uint8_t dst[8],
const VLC_MULTI_ELEM *const Jtable,
const VLCElem *const table,
const int bits, const int max_depth)
--
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".
^ permalink raw reply [flat|nested] 4+ messages in thread
* [FFmpeg-devel] [PATCH 2/3] avcodec/magicyuv: correct end of array check in multi VLC parsing
2023-10-22 15:39 [FFmpeg-devel] [PATCH 1/3] avcodec/bitstream_template: Basic documentation for read_vlc_multi() Michael Niedermayer
@ 2023-10-22 15:39 ` Michael Niedermayer
2023-10-22 15:39 ` [FFmpeg-devel] [PATCH 3/3] avcodec/magicyuv: remove redundant check in inner loop Michael Niedermayer
2023-10-26 22:45 ` [FFmpeg-devel] [PATCH 1/3] avcodec/bitstream_template: Basic documentation for read_vlc_multi() Michael Niedermayer
2 siblings, 0 replies; 4+ messages in thread
From: Michael Niedermayer @ 2023-10-22 15:39 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Fixes: out of array write
Fixes: 63390/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MAGICYUV_fuzzer-5144552979431424.fuzz
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
libavcodec/magicyuv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavcodec/magicyuv.c b/libavcodec/magicyuv.c
index 3573db0f0ad..d813f209203 100644
--- a/libavcodec/magicyuv.c
+++ b/libavcodec/magicyuv.c
@@ -299,7 +299,7 @@ static int magy_decode_slice(AVCodecContext *avctx, void *tdata,
return ret;
for (k = 0; k < height; k++)
- READ_PLANE(dst, i, 1, 5)
+ READ_PLANE(dst, i, 1, 7)
}
switch (pred) {
--
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".
^ permalink raw reply [flat|nested] 4+ messages in thread
* [FFmpeg-devel] [PATCH 3/3] avcodec/magicyuv: remove redundant check in inner loop
2023-10-22 15:39 [FFmpeg-devel] [PATCH 1/3] avcodec/bitstream_template: Basic documentation for read_vlc_multi() Michael Niedermayer
2023-10-22 15:39 ` [FFmpeg-devel] [PATCH 2/3] avcodec/magicyuv: correct end of array check in multi VLC parsing Michael Niedermayer
@ 2023-10-22 15:39 ` Michael Niedermayer
2023-10-26 22:45 ` [FFmpeg-devel] [PATCH 1/3] avcodec/bitstream_template: Basic documentation for read_vlc_multi() Michael Niedermayer
2 siblings, 0 replies; 4+ messages in thread
From: Michael Niedermayer @ 2023-10-22 15:39 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
libavcodec/magicyuv.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/libavcodec/magicyuv.c b/libavcodec/magicyuv.c
index d813f209203..3f6348b531e 100644
--- a/libavcodec/magicyuv.c
+++ b/libavcodec/magicyuv.c
@@ -125,10 +125,9 @@ static void magicyuv_median_pred16(uint16_t *dst, const uint16_t *src1,
for (; CACHED_BITSTREAM_READER && x < width-c && get_bits_left(&gb) > 0;) {\
ret = get_vlc_multi(&gb, (uint8_t *)dst + x * b, multi, \
vlc, vlc_bits, 3); \
- if (ret > 0) \
- x += ret; \
if (ret <= 0) \
return AVERROR_INVALIDDATA; \
+ x += ret; \
} \
for (; x < width && get_bits_left(&gb) > 0; x++) \
dst[x] = get_vlc2(&gb, vlc, vlc_bits, 3); \
--
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".
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/3] avcodec/bitstream_template: Basic documentation for read_vlc_multi()
2023-10-22 15:39 [FFmpeg-devel] [PATCH 1/3] avcodec/bitstream_template: Basic documentation for read_vlc_multi() Michael Niedermayer
2023-10-22 15:39 ` [FFmpeg-devel] [PATCH 2/3] avcodec/magicyuv: correct end of array check in multi VLC parsing Michael Niedermayer
2023-10-22 15:39 ` [FFmpeg-devel] [PATCH 3/3] avcodec/magicyuv: remove redundant check in inner loop Michael Niedermayer
@ 2023-10-26 22:45 ` Michael Niedermayer
2 siblings, 0 replies; 4+ messages in thread
From: Michael Niedermayer @ 2023-10-26 22:45 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 554 bytes --]
On Sun, Oct 22, 2023 at 05:39:49PM +0200, Michael Niedermayer wrote:
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
> libavcodec/bitstream_template.h | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
will apply patchset, dont want to leave this open
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Take away the freedom of one citizen and you will be jailed, take away
the freedom of all citizens and you will be congratulated by your peers
in Parliament.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
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".
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-10-26 22:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-22 15:39 [FFmpeg-devel] [PATCH 1/3] avcodec/bitstream_template: Basic documentation for read_vlc_multi() Michael Niedermayer
2023-10-22 15:39 ` [FFmpeg-devel] [PATCH 2/3] avcodec/magicyuv: correct end of array check in multi VLC parsing Michael Niedermayer
2023-10-22 15:39 ` [FFmpeg-devel] [PATCH 3/3] avcodec/magicyuv: remove redundant check in inner loop Michael Niedermayer
2023-10-26 22:45 ` [FFmpeg-devel] [PATCH 1/3] avcodec/bitstream_template: Basic documentation for read_vlc_multi() Michael Niedermayer
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