PR #21507 opened by mkver URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21507 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21507.patch
ff_mlp_restart_checksum() used the (undocumented) layout of the CRC tables and therefore broke on x86 when the clmul implementation added in dc03cffe9c9577127ef82b6f56118115f900e5f2 is used. This commit fixes this. >From f330d178adf5508607f2c1f3d0cc0201b6fd4d18 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt <[email protected]> Date: Mon, 19 Jan 2026 00:26:34 +0100 Subject: [PATCH] avcodec/mlp: Don't use internals of CRC API ff_mlp_restart_checksum() used the (undocumented) layout of the CRC tables and therefore broke on x86 when the clmul implementation added in dc03cffe9c9577127ef82b6f56118115f900e5f2 is used. This commit fixes this. Signed-off-by: Andreas Rheinhardt <[email protected]> --- libavcodec/mlp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavcodec/mlp.c b/libavcodec/mlp.c index 33045c08c7..8ea6e6d72e 100644 --- a/libavcodec/mlp.c +++ b/libavcodec/mlp.c @@ -107,8 +107,11 @@ uint8_t ff_mlp_restart_checksum(const uint8_t *buf, unsigned int bit_size) int i; int num_bytes = (bit_size + 2) / 8; - int crc = crc_1D[buf[0] & 0x3f]; - crc = av_crc(crc_1D, crc, buf + 1, num_bytes - 2); + // The two most significant bits of buf[0] are not supposed + // to be contained in the checksum; using buf[0] & 0xC0 as start value + // achieves this. + int crc = av_crc(crc_1D, buf[0] & 0xC0, buf, num_bytes - 1); + crc ^= buf[num_bytes - 1]; for (i = 0; i < ((bit_size + 2) & 7); i++) { -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
