vpx_int_pro_row_c: add an assert for height
authorJames Zern <jzern@google.com>
Tue, 19 Jul 2022 01:56:03 +0000 (18:56 -0700)
committerJames Zern <jzern@google.com>
Tue, 19 Jul 2022 02:11:28 +0000 (19:11 -0700)
this quiets a static analysis warning with clang 11:

vpx_dsp/avg.c:353:15: warning: Assigned value is garbage or undefined
[core.uninitialized.Assign]
    hbuf[idx] /= norm_factor;
              ^  ~~~~~~~~~~~

the same fix was applied in libaom:
1ad0889bc aom_int_pro_row_c: add an assert for height

Bug: b/229626362
Change-Id: Ic8a249f866b33b02ec9f378581e51ac104d97169

vpx_dsp/avg.c

index 1c45e8a..9540154 100644 (file)
@@ -7,6 +7,8 @@
  *  in the file PATENTS.  All contributing project authors may
  *  be found in the AUTHORS file in the root of the source tree.
  */
+
+#include <assert.h>
 #include <stdlib.h>
 
 #include "./vpx_dsp_rtcd.h"
@@ -344,6 +346,7 @@ void vpx_int_pro_row_c(int16_t hbuf[16], const uint8_t *ref,
                        const int ref_stride, const int height) {
   int idx;
   const int norm_factor = height >> 1;
+  assert(height >= 2);
   for (idx = 0; idx < 16; ++idx) {
     int i;
     hbuf[idx] = 0;