This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch release/9.0 in repository ffmpeg.
commit f0fe25b1ec1e6597f4519e8674b64567604da07c Author: Haochen Chen <[email protected]> AuthorDate: Thu Jul 30 22:54:16 2026 +0000 Commit: Michael Niedermayer <[email protected]> CommitDate: Fri Sep 4 21:53:59 2026 +0200 avcodec/bmp: fix misaligned read in 16-bit decoding Fixes a misaligned read in bmp_decode_frame when decoding 16-bit BMPs. The code was casting a potentially unaligned uint8_t pointer to uint16_t* and dereferencing it. This triggers a UBSAN trap (SIGILL / UD1) on environments configured to trap on undefined behavior. Replaced with AV_RL16 to perform safe unaligned reads. Signed-off-by: Haochen Chen <[email protected]> (cherry picked from commit 87f6fa9d41e4a31faeabd355a9c2365c6bb9465f) Signed-off-by: Michael Niedermayer <[email protected]> --- libavcodec/bmp.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libavcodec/bmp.c b/libavcodec/bmp.c index db5d704057..c7614f6f7e 100644 --- a/libavcodec/bmp.c +++ b/libavcodec/bmp.c @@ -27,6 +27,7 @@ #include "codec_internal.h" #include "decode.h" #include "msrledec.h" +#include "libavutil/intreadwrite.h" static int bmp_decode_frame(AVCodecContext *avctx, AVFrame *p, int *got_frame, AVPacket *avpkt) @@ -326,11 +327,13 @@ static int bmp_decode_frame(AVCodecContext *avctx, AVFrame *p, break; case 16: for (i = 0; i < avctx->height; i++) { - const uint16_t *src = (const uint16_t *) buf; + const uint8_t *src = buf; uint16_t *dst = (uint16_t *) ptr; - for (j = 0; j < avctx->width; j++) - *dst++ = av_le2ne16(*src++); + for (j = 0; j < avctx->width; j++) { + *dst++ = AV_RL16(src); + src += 2; + } buf += n; ptr += linesize; -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
