avutil/error: Fix overflow when negating

-INT_MIN is not representable in an int.
Fixes issue #22388.

Reviewed-by: Sean McGovern <gseanmcg@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2026-03-05 10:51:59 +01:00
parent 987d13d13c
commit 5d3ad4f06e

View File

@@ -140,7 +140,7 @@ int av_strerror(int errnum, char *errbuf, size_t errbuf_size)
}
}
#if HAVE_STRERROR_R
int ret = AVERROR(strerror_r(AVUNERROR(errnum), errbuf, errbuf_size));
int ret = AVERROR(strerror_r(AVUNERROR((unsigned)errnum), errbuf, errbuf_size));
#else
int ret = -1;
#endif