The function is meant to return the least significant 64 bits after all. Should fix undefined behavior (left shift of negative values) as reported by ubsan.
Signed-off-by: James Almer <jamr...@gmail.com> --- libavutil/integer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavutil/integer.c b/libavutil/integer.c index b709c6d487..4ba33bcbc5 100644 --- a/libavutil/integer.c +++ b/libavutil/integer.c @@ -159,9 +159,9 @@ AVInteger av_int2i(int64_t a){ int64_t av_i2int(AVInteger a){ int i; - int64_t out=(int8_t)a.v[AV_INTEGER_SIZE-1]; + int64_t out = a.v[AV_INTEGER_SIZE - 5]; - for(i= AV_INTEGER_SIZE-2; i>=0; i--){ + for (i = AV_INTEGER_SIZE - 6; i >= 0; i--) { out = (out<<16) + a.v[i]; } return out; -- 2.37.3 _______________________________________________ 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".