aom: Increase scaling in linsolve_wiener (93499)

From 93499d87f4c5417577c86de9075f2e232464ae13 Mon Sep 17 00:00:00 2001
From: Debargha Mukherjee <[EMAIL REDACTED]>
Date: Thu, 23 May 2024 01:24:40 +0000
Subject: [PATCH] Increase scaling in linsolve_wiener

Reduces likelihood of overflows and re-enables previously
disabled overflow tests.

Bug: b:330639949, oss-fuzz:68195

Change-Id: I2c3dc9bd5783836d65b3c7a4452061b27cf4c82c
(cherry picked from commit 22bcd3de8f4fc43c4e87ef9dedfb40594fb1569b)
---
 av1/encoder/pickrst.c | 2 +-
 test/wiener_test.cc   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/av1/encoder/pickrst.c b/av1/encoder/pickrst.c
index b0d0d0bb7..53a70e41b 100644
--- a/av1/encoder/pickrst.c
+++ b/av1/encoder/pickrst.c
@@ -1176,7 +1176,7 @@ static int linsolve_wiener(int n, int64_t *A, int stride, int64_t *b,
       if (abs_akj > max_abs_akj) max_abs_akj = abs_akj;
     }
     const int scale_threshold = 1 << 22;
-    const int scaler_A = max_abs_akj < scale_threshold ? 1 : (1 << 5);
+    const int scaler_A = max_abs_akj < scale_threshold ? 1 : (1 << 6);
     const int scaler_c = max_abs_akj < scale_threshold ? 1 : (1 << 7);
     const int scaler = scaler_c * scaler_A;
 
diff --git a/test/wiener_test.cc b/test/wiener_test.cc
index 052f095b5..467507f1f 100644
--- a/test/wiener_test.cc
+++ b/test/wiener_test.cc
@@ -1693,7 +1693,7 @@ TEST(SearchWienerTest, 8bitSignedIntegerOverflowInUpdateBSepSym) {
 
 // A test that reproduces crbug.com/oss-fuzz/68195: signed integer overflow in
 // linsolve_wiener().
-TEST(SearchWienerTest, DISABLED_8bitSignedIntegerOverflowInLinsolveWiener) {
+TEST(SearchWienerTest, 8bitSignedIntegerOverflowInLinsolveWiener) {
   constexpr int kWidth = 4;
   constexpr int kHeight = 3;
   constexpr unsigned char kBuffer[kWidth * kHeight] = {
@@ -1861,7 +1861,7 @@ TEST(SearchWienerTest, 10bitSignedIntegerOverflowInLinsolveWiener) {
 
 // A test that reproduces b/330639949: signed integer overflow in
 // linsolve_wiener().
-TEST(SearchWienerTest, DISABLED_12bitSignedIntegerOverflowInLinsolveWiener) {
+TEST(SearchWienerTest, 12bitSignedIntegerOverflowInLinsolveWiener) {
   constexpr int kWidth = 173;
   constexpr int kHeight = 3;
   // Since the image format is YUV 4:2:0, aom_img_wrap() expects the buffer is