]> git.ipfire.org Git - thirdparty/asterisk.git/commit
Astobj2: Correctly treat hash_fn returning INT_MIN 31/531/4
authorIvan Poddubny <ivan.poddubny@gmail.com>
Sun, 24 May 2015 18:47:16 +0000 (21:47 +0300)
committerIvan Poddubny <ivan.poddubny@gmail.com>
Mon, 25 May 2015 07:17:48 +0000 (02:17 -0500)
commit97a6ce1717bd0c4b1b4305f10f13fd5ec9bb7441
tree84c21a406c1422e30ccebdc4d0cd56286bc0fd96
parentb9826bf101b238aa704d56af29925a571f8bcb1b
Astobj2: Correctly treat hash_fn returning INT_MIN

The code in astobj2_hash.c wrongly assumed that abs(int) is always > 0.
However, abs(INT_MIN) = INT_MIN and is still negative, as well as
abs(INT_MIN) % num_buckets, and as a result this led to a crash.

One way to trigger the bug is using host=::80 or 0.0.0.128 in peer
configuration section in chan_sip or chan_iax.

This patch takes the remainder before applying abs, so that bucket
number is always in range.

ASTERISK-25100 #close
Reported by: Mark Petersen

Change-Id: Id6981400ad526f47e10bcf7b847b62bd2785e899
main/astobj2_hash.c