From a532c243bb2b5bb0fd0ef295eb019518cc532ca5 Mon Sep 17 00:00:00 2001 From: Johann Date: Fri, 3 Aug 2018 15:36:59 -0700 Subject: [PATCH] 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 --- vp9/decoder/vp9_decodeframe.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vp9/decoder/vp9_decodeframe.c b/vp9/decoder/vp9_decodeframe.c index 9c793f710..2d6dbe8d7 100644 --- a/vp9/decoder/vp9_decodeframe.c +++ b/vp9/decoder/vp9_decodeframe.c @@ -1532,9 +1532,9 @@ static int tile_worker_hook(void *arg1, void *arg2) { // 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, -- 2.40.0