* [FFmpeg-devel] [PATCH 02/15] avcodec/cri: Check length
2024-07-05 0:21 [FFmpeg-devel] [PATCH 01/15] avcodec/xsubdec: Check parse_timecode() Michael Niedermayer
@ 2024-07-05 0:21 ` Michael Niedermayer
2024-07-05 0:21 ` [FFmpeg-devel] [PATCH 03/15] avcodec/dxv: Fix type in get_opcodes() Michael Niedermayer
` (13 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Michael Niedermayer @ 2024-07-05 0:21 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Fixes: CID1604394 Overflowed constant
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
libavcodec/cri.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libavcodec/cri.c b/libavcodec/cri.c
index 7b9a350967a..6932bb67456 100644
--- a/libavcodec/cri.c
+++ b/libavcodec/cri.c
@@ -234,10 +234,14 @@ static int cri_decode_frame(AVCodecContext *avctx, AVFrame *p,
s->data_size = length;
goto skip;
case 105:
+ if (length <= 0)
+ return AVERROR_INVALIDDATA;
hflip = bytestream2_get_byte(gb) != 0;
length--;
goto skip;
case 106:
+ if (length <= 0)
+ return AVERROR_INVALIDDATA;
vflip = bytestream2_get_byte(gb) != 0;
length--;
goto skip;
--
2.45.2
_______________________________________________
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] 16+ messages in thread
* [FFmpeg-devel] [PATCH 03/15] avcodec/dxv: Fix type in get_opcodes()
2024-07-05 0:21 [FFmpeg-devel] [PATCH 01/15] avcodec/xsubdec: Check parse_timecode() Michael Niedermayer
2024-07-05 0:21 ` [FFmpeg-devel] [PATCH 02/15] avcodec/cri: Check length Michael Niedermayer
@ 2024-07-05 0:21 ` Michael Niedermayer
2024-07-05 0:21 ` [FFmpeg-devel] [PATCH 04/15] avcodec/golomb: Document return for get_ur_golomb_jpegls() and get_sr_golomb_flac() Michael Niedermayer
` (12 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Michael Niedermayer @ 2024-07-05 0:21 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Found by code review related to CID1604386 Overflowed constant
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
libavcodec/dxv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavcodec/dxv.c b/libavcodec/dxv.c
index 7c873a3e922..ba23222727f 100644
--- a/libavcodec/dxv.c
+++ b/libavcodec/dxv.c
@@ -240,7 +240,7 @@ static int get_opcodes(GetByteContext *gb, uint32_t *table, uint8_t *dst, int op
size_in_bits = bytestream2_get_le32(gb);
endoffset = ((size_in_bits + 7) >> 3) - 4;
- if (endoffset <= 0 || bytestream2_get_bytes_left(gb) < endoffset)
+ if ((int)endoffset <= 0 || bytestream2_get_bytes_left(gb) < endoffset)
return AVERROR_INVALIDDATA;
offset = endoffset;
--
2.45.2
_______________________________________________
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] 16+ messages in thread
* [FFmpeg-devel] [PATCH 04/15] avcodec/golomb: Document return for get_ur_golomb_jpegls() and get_sr_golomb_flac()
2024-07-05 0:21 [FFmpeg-devel] [PATCH 01/15] avcodec/xsubdec: Check parse_timecode() Michael Niedermayer
2024-07-05 0:21 ` [FFmpeg-devel] [PATCH 02/15] avcodec/cri: Check length Michael Niedermayer
2024-07-05 0:21 ` [FFmpeg-devel] [PATCH 03/15] avcodec/dxv: Fix type in get_opcodes() Michael Niedermayer
@ 2024-07-05 0:21 ` Michael Niedermayer
2024-07-05 0:21 ` [FFmpeg-devel] [PATCH 05/15] avcodec/golomb: Assert that k is in the supported range for get_ur/sr_golomb() Michael Niedermayer
` (11 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Michael Niedermayer @ 2024-07-05 0:21 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Found while reviewing code related to CID1604409 Overflowed return value
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
libavcodec/golomb.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libavcodec/golomb.h b/libavcodec/golomb.h
index 164c2583b6c..9f60fe03976 100644
--- a/libavcodec/golomb.h
+++ b/libavcodec/golomb.h
@@ -424,6 +424,8 @@ static inline int get_ur_golomb(GetBitContext *gb, int k, int limit,
/**
* read unsigned golomb rice code (jpegls).
+ *
+ * @returns -1 on error
*/
static inline int get_ur_golomb_jpegls(GetBitContext *gb, int k, int limit,
int esc_len)
@@ -535,6 +537,8 @@ static inline int get_sr_golomb(GetBitContext *gb, int k, int limit,
/**
* read signed golomb rice code (flac).
+ *
+ * @returns INT_MIN on error
*/
static inline int get_sr_golomb_flac(GetBitContext *gb, int k, int limit,
int esc_len)
--
2.45.2
_______________________________________________
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] 16+ messages in thread
* [FFmpeg-devel] [PATCH 05/15] avcodec/golomb: Assert that k is in the supported range for get_ur/sr_golomb()
2024-07-05 0:21 [FFmpeg-devel] [PATCH 01/15] avcodec/xsubdec: Check parse_timecode() Michael Niedermayer
` (2 preceding siblings ...)
2024-07-05 0:21 ` [FFmpeg-devel] [PATCH 04/15] avcodec/golomb: Document return for get_ur_golomb_jpegls() and get_sr_golomb_flac() Michael Niedermayer
@ 2024-07-05 0:21 ` Michael Niedermayer
2024-07-05 0:21 ` [FFmpeg-devel] [PATCH 06/15] avcodec/hw_base_encode: Simplify EOF check Michael Niedermayer
` (10 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Michael Niedermayer @ 2024-07-05 0:21 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Found by code review related to CID1604563 Overflowed return value
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
libavcodec/golomb.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/libavcodec/golomb.h b/libavcodec/golomb.h
index 9f60fe03976..742334978d5 100644
--- a/libavcodec/golomb.h
+++ b/libavcodec/golomb.h
@@ -402,6 +402,7 @@ static inline int get_ur_golomb(GetBitContext *gb, int k, int limit,
log = av_log2(buf);
if (log > 31 - limit) {
+ av_assert2(log >= k);
buf >>= log - k;
buf += (30U - log) << k;
LAST_SKIP_BITS(re, gb, 32 + k - log);
--
2.45.2
_______________________________________________
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] 16+ messages in thread
* [FFmpeg-devel] [PATCH 06/15] avcodec/hw_base_encode: Simplify EOF check
2024-07-05 0:21 [FFmpeg-devel] [PATCH 01/15] avcodec/xsubdec: Check parse_timecode() Michael Niedermayer
` (3 preceding siblings ...)
2024-07-05 0:21 ` [FFmpeg-devel] [PATCH 05/15] avcodec/golomb: Assert that k is in the supported range for get_ur/sr_golomb() Michael Niedermayer
@ 2024-07-05 0:21 ` Michael Niedermayer
2024-07-05 0:21 ` [FFmpeg-devel] [PATCH 07/15] avcodec/iff: Use signed count Michael Niedermayer
` (9 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Michael Niedermayer @ 2024-07-05 0:21 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Found while reviewing CID1608712 Explicit null dereferenced
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
libavcodec/hw_base_encode.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/libavcodec/hw_base_encode.c b/libavcodec/hw_base_encode.c
index ecb4be6aa43..6d5632c2988 100644
--- a/libavcodec/hw_base_encode.c
+++ b/libavcodec/hw_base_encode.c
@@ -546,11 +546,10 @@ start:
}
err = ff_encode_get_frame(avctx, frame);
- if (err < 0 && err != AVERROR_EOF)
- return err;
-
- if (err == AVERROR_EOF)
+ if (err == AVERROR_EOF) {
frame = NULL;
+ } else if (err < 0)
+ return err;
err = hw_base_encode_send_frame(avctx, ctx, frame);
if (err < 0)
--
2.45.2
_______________________________________________
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] 16+ messages in thread
* [FFmpeg-devel] [PATCH 07/15] avcodec/iff: Use signed count
2024-07-05 0:21 [FFmpeg-devel] [PATCH 01/15] avcodec/xsubdec: Check parse_timecode() Michael Niedermayer
` (4 preceding siblings ...)
2024-07-05 0:21 ` [FFmpeg-devel] [PATCH 06/15] avcodec/hw_base_encode: Simplify EOF check Michael Niedermayer
@ 2024-07-05 0:21 ` Michael Niedermayer
2024-07-05 0:21 ` [FFmpeg-devel] [PATCH 08/15] avcodec/imm4: check cbphi for error Michael Niedermayer
` (8 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Michael Niedermayer @ 2024-07-05 0:21 UTC (permalink / raw)
To: FFmpeg development discussions and patches
This is more a style fix than a bugfix (CID1604392 Overflowed constant)
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
libavcodec/iff.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavcodec/iff.c b/libavcodec/iff.c
index 4b3e8e0c21e..13010b451ef 100644
--- a/libavcodec/iff.c
+++ b/libavcodec/iff.c
@@ -523,7 +523,7 @@ static int decode_byterun2(uint8_t *dst, int height, int line_size,
GetByteContext *gb)
{
GetByteContext cmds;
- unsigned count;
+ int count;
int i, y_pos = 0, x_pos = 0;
if (bytestream2_get_be32(gb) != MKBETAG('V', 'D', 'A', 'T'))
@@ -531,7 +531,7 @@ static int decode_byterun2(uint8_t *dst, int height, int line_size,
bytestream2_skip(gb, 4);
count = bytestream2_get_be16(gb) - 2;
- if (bytestream2_get_bytes_left(gb) < count)
+ if (count < 0 || bytestream2_get_bytes_left(gb) < count)
return 0;
bytestream2_init(&cmds, gb->buffer, count);
--
2.45.2
_______________________________________________
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] 16+ messages in thread
* [FFmpeg-devel] [PATCH 08/15] avcodec/imm4: check cbphi for error
2024-07-05 0:21 [FFmpeg-devel] [PATCH 01/15] avcodec/xsubdec: Check parse_timecode() Michael Niedermayer
` (5 preceding siblings ...)
2024-07-05 0:21 ` [FFmpeg-devel] [PATCH 07/15] avcodec/iff: Use signed count Michael Niedermayer
@ 2024-07-05 0:21 ` Michael Niedermayer
2024-07-05 0:21 ` [FFmpeg-devel] [PATCH 09/15] avcodec/leaddec: Check init_get_bits8() for failure Michael Niedermayer
` (7 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Michael Niedermayer @ 2024-07-05 0:21 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Fixes: CID1604356 Overflowed constant
Fixes: CID1604573 Overflowed constant
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
libavcodec/imm4.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/libavcodec/imm4.c b/libavcodec/imm4.c
index 3a4ad8616f5..a6da8fcf95b 100644
--- a/libavcodec/imm4.c
+++ b/libavcodec/imm4.c
@@ -220,12 +220,15 @@ static int decode_intra(AVCodecContext *avctx, GetBitContext *gb, AVFrame *frame
for (y = 0; y < avctx->height; y += 16) {
for (x = 0; x < avctx->width; x += 16) {
- unsigned flag, cbphi, cbplo;
+ unsigned flag, cbplo;
+ int cbphi;
cbplo = get_vlc2(gb, cbplo_tab, CBPLO_VLC_BITS, 1);
flag = get_bits1(gb);
cbphi = get_cbphi(gb, 1);
+ if (cbphi < 0)
+ return cbphi;
ret = decode_blocks(avctx, gb, cbplo | (cbphi << 2), 0, offset, flag);
if (ret < 0)
@@ -273,7 +276,8 @@ static int decode_inter(AVCodecContext *avctx, GetBitContext *gb,
for (y = 0; y < avctx->height; y += 16) {
for (x = 0; x < avctx->width; x += 16) {
int reverse, intra_block, value;
- unsigned cbphi, cbplo, flag2 = 0;
+ unsigned cbplo, flag2 = 0;
+ int cbphi;
if (get_bits1(gb)) {
copy_block16(frame->data[0] + y * frame->linesize[0] + x,
@@ -299,6 +303,9 @@ static int decode_inter(AVCodecContext *avctx, GetBitContext *gb,
cbplo = value >> 4;
cbphi = get_cbphi(gb, reverse);
+ if (cbphi < 0)
+ return cbphi;
+
if (intra_block) {
ret = decode_blocks(avctx, gb, cbplo | (cbphi << 2), 0, offset, flag2);
if (ret < 0)
--
2.45.2
_______________________________________________
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] 16+ messages in thread
* [FFmpeg-devel] [PATCH 09/15] avcodec/leaddec: Check init_get_bits8() for failure
2024-07-05 0:21 [FFmpeg-devel] [PATCH 01/15] avcodec/xsubdec: Check parse_timecode() Michael Niedermayer
` (6 preceding siblings ...)
2024-07-05 0:21 ` [FFmpeg-devel] [PATCH 08/15] avcodec/imm4: check cbphi for error Michael Niedermayer
@ 2024-07-05 0:21 ` Michael Niedermayer
2024-07-05 0:21 ` [FFmpeg-devel] [PATCH 10/15] avcodec/loco: check get_ur_golomb_jpegls() " Michael Niedermayer
` (6 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Michael Niedermayer @ 2024-07-05 0:21 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Fixes: CID1604416 Unchecked return value
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
libavcodec/leaddec.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/libavcodec/leaddec.c b/libavcodec/leaddec.c
index 947c7275bec..2f5152c2261 100644
--- a/libavcodec/leaddec.c
+++ b/libavcodec/leaddec.c
@@ -194,7 +194,9 @@ static int lead_decode_frame(AVCodecContext *avctx, AVFrame * frame,
i++;
}
- init_get_bits8(&gb, s->bitstream_buf, size);
+ ret = init_get_bits8(&gb, s->bitstream_buf, size);
+ if (ret < 0)
+ return ret;
if (avctx->pix_fmt == AV_PIX_FMT_YUV420P && zero) {
for (int mb_y = 0; mb_y < avctx->height / 8; mb_y++)
--
2.45.2
_______________________________________________
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] 16+ messages in thread
* [FFmpeg-devel] [PATCH 10/15] avcodec/loco: check get_ur_golomb_jpegls() for failure
2024-07-05 0:21 [FFmpeg-devel] [PATCH 01/15] avcodec/xsubdec: Check parse_timecode() Michael Niedermayer
` (7 preceding siblings ...)
2024-07-05 0:21 ` [FFmpeg-devel] [PATCH 09/15] avcodec/leaddec: Check init_get_bits8() for failure Michael Niedermayer
@ 2024-07-05 0:21 ` Michael Niedermayer
2024-07-05 0:21 ` [FFmpeg-devel] [PATCH 11/15] avcodec/loco: Check loco_get_rice() " Michael Niedermayer
` (5 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Michael Niedermayer @ 2024-07-05 0:21 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Fixes: CID1604400 Overflowed constant
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
libavcodec/loco.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/libavcodec/loco.c b/libavcodec/loco.c
index b1294a97980..4aba1eb9c52 100644
--- a/libavcodec/loco.c
+++ b/libavcodec/loco.c
@@ -92,10 +92,15 @@ static inline int loco_get_rice(RICEContext *r)
if (get_bits_left(&r->gb) < 1)
return INT_MIN;
v = get_ur_golomb_jpegls(&r->gb, loco_get_rice_param(r), INT_MAX, 0);
+ if (v == -1)
+ return INT_MIN;
loco_update_rice_param(r, (v + 1) >> 1);
if (!v) {
if (r->save >= 0) {
- r->run = get_ur_golomb_jpegls(&r->gb, 2, INT_MAX, 0);
+ int run = get_ur_golomb_jpegls(&r->gb, 2, INT_MAX, 0);
+ if (run == -1)
+ return INT_MIN;
+ r->run = run;
if (r->run > 1)
r->save += r->run + 1;
else
--
2.45.2
_______________________________________________
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] 16+ messages in thread
* [FFmpeg-devel] [PATCH 11/15] avcodec/loco: Check loco_get_rice() for failure
2024-07-05 0:21 [FFmpeg-devel] [PATCH 01/15] avcodec/xsubdec: Check parse_timecode() Michael Niedermayer
` (8 preceding siblings ...)
2024-07-05 0:21 ` [FFmpeg-devel] [PATCH 10/15] avcodec/loco: check get_ur_golomb_jpegls() " Michael Niedermayer
@ 2024-07-05 0:21 ` Michael Niedermayer
2024-07-05 0:21 ` [FFmpeg-devel] [PATCH 12/15] avcodec/me_cmp: Fix type check Michael Niedermayer
` (4 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Michael Niedermayer @ 2024-07-05 0:21 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Fixes: CID1604495 Overflowed constant
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
libavcodec/loco.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libavcodec/loco.c b/libavcodec/loco.c
index 4aba1eb9c52..d73d8fa88bb 100644
--- a/libavcodec/loco.c
+++ b/libavcodec/loco.c
@@ -157,6 +157,8 @@ static int loco_decode_plane(LOCOContext *l, uint8_t *data, int width, int heigh
/* restore top left pixel */
val = loco_get_rice(&rc);
+ if (val == INT_MIN)
+ return AVERROR_INVALIDDATA;
data[0] = 128 + val;
/* restore top line */
for (i = 1; i < width; i++) {
--
2.45.2
_______________________________________________
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] 16+ messages in thread
* [FFmpeg-devel] [PATCH 12/15] avcodec/me_cmp: Fix type check
2024-07-05 0:21 [FFmpeg-devel] [PATCH 01/15] avcodec/xsubdec: Check parse_timecode() Michael Niedermayer
` (9 preceding siblings ...)
2024-07-05 0:21 ` [FFmpeg-devel] [PATCH 11/15] avcodec/loco: Check loco_get_rice() " Michael Niedermayer
@ 2024-07-05 0:21 ` Michael Niedermayer
2024-07-05 0:21 ` [FFmpeg-devel] [PATCH 13/15] avcodec/mlpenc: Use 64 for ml, mr Michael Niedermayer
` (3 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Michael Niedermayer @ 2024-07-05 0:21 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Fixes: CID1604375 Out-of-bounds read
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
libavcodec/me_cmp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavcodec/me_cmp.c b/libavcodec/me_cmp.c
index 592ee760840..f3e2f2482ef 100644
--- a/libavcodec/me_cmp.c
+++ b/libavcodec/me_cmp.c
@@ -517,7 +517,7 @@ av_cold int ff_set_cmp(const MECmpContext *c, me_cmp_func *cmp, int type, int mp
cmp[i] = zero_cmp;
return 0;
}
- if (type > FF_ARRAY_ELEMS(cmp_func_list) ||
+ if (type >= FF_ARRAY_ELEMS(cmp_func_list) ||
!cmp_func_list[type].available ||
!mpvenc && cmp_func_list[type].mpv_only) {
av_log(NULL, AV_LOG_ERROR,
--
2.45.2
_______________________________________________
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] 16+ messages in thread
* [FFmpeg-devel] [PATCH 13/15] avcodec/mlpenc: Use 64 for ml, mr
2024-07-05 0:21 [FFmpeg-devel] [PATCH 01/15] avcodec/xsubdec: Check parse_timecode() Michael Niedermayer
` (10 preceding siblings ...)
2024-07-05 0:21 ` [FFmpeg-devel] [PATCH 12/15] avcodec/me_cmp: Fix type check Michael Niedermayer
@ 2024-07-05 0:21 ` Michael Niedermayer
2024-07-05 0:21 ` [FFmpeg-devel] [PATCH 14/15] avcodec/motion_est: Fix score squaring overflow Michael Niedermayer
` (2 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Michael Niedermayer @ 2024-07-05 0:21 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Fixes: CID1604429 Overflowed constant
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
libavcodec/mlpenc.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/libavcodec/mlpenc.c b/libavcodec/mlpenc.c
index 67e0e109aa0..06670de456e 100644
--- a/libavcodec/mlpenc.c
+++ b/libavcodec/mlpenc.c
@@ -1414,7 +1414,8 @@ static int estimate_coeff(MLPEncodeContext *ctx, MLPSubstream *s,
int32_t maxl = INT32_MIN, maxr = INT32_MIN, minl = INT32_MAX, minr = INT32_MAX;
int64_t summ = 0, sums = 0, suml = 0, sumr = 0, enl = 0, enr = 0;
const int shift = 14 - ctx->rematrix_precision;
- int32_t cf0, cf1, e[4], d[4], ml, mr;
+ int32_t cf0, cf1, e[4], d[4];
+ int64_t ml, mr;
int i, count = 0;
for (int j = 0; j <= ctx->cur_restart_interval; j++) {
@@ -1447,8 +1448,8 @@ static int estimate_coeff(MLPEncodeContext *ctx, MLPSubstream *s,
summ -= FFABS(suml + sumr);
sums -= FFABS(suml - sumr);
- ml = maxl - minl;
- mr = maxr - minr;
+ ml = maxl - (int64_t)minl;
+ mr = maxr - (int64_t)minr;
if (!summ && !sums)
return 0;
--
2.45.2
_______________________________________________
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] 16+ messages in thread
* [FFmpeg-devel] [PATCH 14/15] avcodec/motion_est: Fix score squaring overflow
2024-07-05 0:21 [FFmpeg-devel] [PATCH 01/15] avcodec/xsubdec: Check parse_timecode() Michael Niedermayer
` (11 preceding siblings ...)
2024-07-05 0:21 ` [FFmpeg-devel] [PATCH 13/15] avcodec/mlpenc: Use 64 for ml, mr Michael Niedermayer
@ 2024-07-05 0:21 ` Michael Niedermayer
2024-07-05 0:21 ` [FFmpeg-devel] [PATCH 15/15] avcodec/pixlet: Simplify pfx computation Michael Niedermayer
2024-07-12 20:41 ` [FFmpeg-devel] [PATCH 01/15] avcodec/xsubdec: Check parse_timecode() Michael Niedermayer
14 siblings, 0 replies; 16+ messages in thread
From: Michael Niedermayer @ 2024-07-05 0:21 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Fixes: CID1604552 Overflowed constant
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
libavcodec/motion_est.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c
index 554fc9780e2..e4f17fb2d86 100644
--- a/libavcodec/motion_est.c
+++ b/libavcodec/motion_est.c
@@ -1454,7 +1454,7 @@ static inline int direct_search(MpegEncContext * s, int mb_x, int mb_y)
s->b_direct_mv_table[mot_xy][0]= 0;
s->b_direct_mv_table[mot_xy][1]= 0;
- return 256*256*256*64;
+ return 256*256*256*64-1;
}
c->xmin= xmin;
--
2.45.2
_______________________________________________
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] 16+ messages in thread
* [FFmpeg-devel] [PATCH 15/15] avcodec/pixlet: Simplify pfx computation
2024-07-05 0:21 [FFmpeg-devel] [PATCH 01/15] avcodec/xsubdec: Check parse_timecode() Michael Niedermayer
` (12 preceding siblings ...)
2024-07-05 0:21 ` [FFmpeg-devel] [PATCH 14/15] avcodec/motion_est: Fix score squaring overflow Michael Niedermayer
@ 2024-07-05 0:21 ` Michael Niedermayer
2024-07-12 20:41 ` [FFmpeg-devel] [PATCH 01/15] avcodec/xsubdec: Check parse_timecode() Michael Niedermayer
14 siblings, 0 replies; 16+ messages in thread
From: Michael Niedermayer @ 2024-07-05 0:21 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Found by reviewing code related to CID1604365 Overflowed constant
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
libavcodec/pixlet.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavcodec/pixlet.c b/libavcodec/pixlet.c
index 6b6e39f2757..e9c561d70d9 100644
--- a/libavcodec/pixlet.c
+++ b/libavcodec/pixlet.c
@@ -231,8 +231,8 @@ static int read_high_coeffs(AVCodecContext *avctx, const uint8_t *src, int16_t *
if (cnt1 >= length) {
cnt1 = get_bits(bc, nbits);
} else {
- pfx = 14 + ((((uint64_t)(value - 14)) >> 32) & (value - 14));
- if (pfx < 1 || pfx > 25)
+ pfx = FFMIN(value, 14);
+ if (pfx < 1)
return AVERROR_INVALIDDATA;
cnt1 *= (1 << pfx) - 1;
shbits = show_bits(bc, pfx);
--
2.45.2
_______________________________________________
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] 16+ messages in thread
* Re: [FFmpeg-devel] [PATCH 01/15] avcodec/xsubdec: Check parse_timecode()
2024-07-05 0:21 [FFmpeg-devel] [PATCH 01/15] avcodec/xsubdec: Check parse_timecode() Michael Niedermayer
` (13 preceding siblings ...)
2024-07-05 0:21 ` [FFmpeg-devel] [PATCH 15/15] avcodec/pixlet: Simplify pfx computation Michael Niedermayer
@ 2024-07-12 20:41 ` Michael Niedermayer
14 siblings, 0 replies; 16+ messages in thread
From: Michael Niedermayer @ 2024-07-12 20:41 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 522 bytes --]
On Fri, Jul 05, 2024 at 02:21:42AM +0200, Michael Niedermayer wrote:
> Fixes: CID1604490 Overflowed constant
>
> Sponsored-by: Sovereign Tech Fund
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
> libavcodec/xsubdec.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
will apply patchset
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Republics decline into democracies and democracies degenerate into
despotisms. -- Aristotle
[-- 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] 16+ messages in thread