From: Johann Date: Fri, 3 Aug 2018 22:36:59 +0000 (-0700) Subject: vp9: address integer sanitizer warning X-Git-Tag: v1.8.0~447^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a532c243bb2b5bb0fd0ef295eb019518cc532ca5;p=libvpx 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 --- 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,