Re: [FFmpeg-devel] [PATCH 6/6] avcodec/apedec: Use NABS to avoid undefined negation

2024-04-02 Thread Michael Niedermayer
On Mon, Apr 01, 2024 at 10:56:07PM +0200, Michael Niedermayer wrote:
> Fixes: negation of -2147483648 cannot be represented in type 'int32_t' (aka 
> 'int'); cast to an unsigned type to negate this value to itself
> Fixes: 
> 67738/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5444313212321792
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/apedec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 6/6] avcodec/apedec: Use NABS to avoid undefined negation

2024-04-01 Thread Michael Niedermayer
Fixes: negation of -2147483648 cannot be represented in type 'int32_t' (aka 
'int'); cast to an unsigned type to negate this value to itself
Fixes: 
67738/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5444313212321792

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/apedec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index 86b79182a73..d75a85f4664 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -1287,7 +1287,7 @@ static void predictor_decode_stereo_3950(APEContext *ctx, 
int count)
 int32_t left  = a1 - (unsigned)(a0 / 2);
 int32_t right = left + (unsigned)a0;
 
-if (FFMAX(FFABS(left), FFABS(right)) > (1<<23)) {
+if (FFMIN(FFNABS(left), FFNABS(right)) < -(1<<23)) {
 ctx->interim_mode = !interim_mode;
 av_log(ctx->avctx, AV_LOG_VERBOSE, "Interim mode: %d\n", 
ctx->interim_mode);
 break;
-- 
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-requ...@ffmpeg.org with subject "unsubscribe".