Skip to content

Commit

Permalink
disable Intra4Preds_NEON
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jzern committed Oct 2, 2024
1 parent 84b118c commit 169dfbf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/dsp/enc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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

Expand Down
6 changes: 5 additions & 1 deletion src/dsp/enc_neon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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; \
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 169dfbf

Please sign in to comment.