From 169dfbf9310808b9cbd05662f7bfee97f5e86582 Mon Sep 17 00:00:00 2001 From: James Zern Date: Wed, 2 Oct 2024 15:23:03 -0700 Subject: [PATCH] disable Intra4Preds_NEON The load of the `top` parameter may over read causing MSan errors: ==7373==WARNING: MemorySanitizer: use-of-uninitialized-value #0 0xfff891d52ad4 in Intra4Preds_NEON src/dsp/enc_neon.c:1003:12 #1 0xfff892d87618 in MakeIntra4Preds src/enc/quant_enc.c:484:3 Bug: b:366668849 Change-Id: I29cf3b2f402ee79ea93c1ee2a4fdd95083aeed68 --- src/dsp/enc.c | 7 +++++-- src/dsp/enc_neon.c | 6 +++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/dsp/enc.c b/src/dsp/enc.c index cb44ba6f..1d1aac59 100644 --- a/src/dsp/enc.c +++ b/src/dsp/enc.c @@ -345,7 +345,8 @@ static void Intra16Preds_C(uint8_t* dst, //------------------------------------------------------------------------------ // luma 4x4 prediction -#if !WEBP_NEON_OMIT_C_CODE || !WEBP_AARCH64 +// TODO: b/366668849 - Restore this condition after Intra4Preds_NEON is fixed. +#if 1 // !WEBP_NEON_OMIT_C_CODE || !WEBP_AARCH64 #define DST(x, y) dst[(x) + (y) * BPS] #define AVG3(a, b, c) ((uint8_t)(((a) + 2 * (b) + (c) + 2) >> 2)) @@ -769,8 +770,10 @@ WEBP_DSP_INIT_FUNC(VP8EncDspInit) { VP8EncQuantizeBlockWHT = QuantizeBlock_C; #endif -#if !WEBP_NEON_OMIT_C_CODE || !WEBP_AARCH64 + // TODO: b/366668849 - Move this into the #if after Intra4Preds_NEON is + // fixed. VP8EncPredLuma4 = Intra4Preds_C; +#if !WEBP_NEON_OMIT_C_CODE || !WEBP_AARCH64 VP8EncPredLuma16 = Intra16Preds_C; #endif diff --git a/src/dsp/enc_neon.c b/src/dsp/enc_neon.c index 7ba5b2d6..5b88c07e 100644 --- a/src/dsp/enc_neon.c +++ b/src/dsp/enc_neon.c @@ -913,6 +913,8 @@ static int Quantize2Blocks_NEON(int16_t in[32], int16_t out[32], #if WEBP_AARCH64 +// TODO: b/366668849 - enable Intra4Preds_NEON after fixing overread. +#if 0 #define DC4_VE4_HE4_TM4_NEON(dst, tbl, res, lane) \ do { \ uint8x16_t r; \ @@ -1023,6 +1025,7 @@ static void Intra4Preds_NEON(uint8_t* dst, const uint8_t* top) { vst1_u8(dst + I4HD4 + BPS * 2, vget_low_u8(result1)); vst1_u8(dst + I4HD4 + BPS * 3, vget_high_u8(result1)); } +#endif // 0 static WEBP_INLINE void Fill_NEON(uint8_t* dst, const uint8_t value) { uint8x16_t a = vdupq_n_u8(value); @@ -1193,7 +1196,8 @@ WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspInitNEON(void) { VP8SSE4x4 = SSE4x4_NEON; #if WEBP_AARCH64 -#if BPS == 32 + // TODO: b/366668849 - enable Intra4Preds_NEON after fixing overread. +#if 0 // BPS == 32 VP8EncPredLuma4 = Intra4Preds_NEON; #endif VP8EncPredLuma16 = Intra16Preds_NEON;