shithub: libvpx

Download patch

ref: a532c243bb2b5bb0fd0ef295eb019518cc532ca5
parent: e1acea5a2843deb8628e9211ae2ff40cdc1818e7
author: Johann <johannkoenig@google.com>
date: Fri Aug 3 11:36:59 EDT 2018

vp9: address integer sanitizer warning

Comparing the size values with subtraction requires casting. Sort in
descending order.

(a < b) - (a > b)
If a is greater, this is 0 - 1 = -1
If the  values are equal, this is 0 - 0 = 0
If b is greater, this is 1 - 0 = 1

Change-Id: I5c20fd10fbc97c391c6858235c44d25d7db57f0e

--- a/vp9/decoder/vp9_decodeframe.c
+++ b/vp9/decoder/vp9_decodeframe.c
@@ -1532,9 +1532,9 @@
 
 // sorts in descending order
 static int compare_tile_buffers(const void *a, const void *b) {
-  const TileBuffer *const buf1 = (const TileBuffer *)a;
-  const TileBuffer *const buf2 = (const TileBuffer *)b;
-  return (int)((int64_t)buf2->size - buf1->size);
+  const TileBuffer *const buf_a = (const TileBuffer *)a;
+  const TileBuffer *const buf_b = (const TileBuffer *)b;
+  return (buf_a->size < buf_b->size) - (buf_a->size > buf_b->size);
 }
 
 static const uint8_t *decode_tiles_mt(VP9Decoder *pbi, const uint8_t *data,