[PATCH 1/3] libdw: Make srclines use a stable sort

Mark Wielaard mjw at redhat.com
Tue Dec 16 10:10:17 UTC 2014

On Mon, 2014-12-15 at 13:48 -0800, Josh Stone wrote:
> On 12/13/2014 03:18 PM, Mark Wielaard wrote:
> > On Thu, Dec 11, 2014 at 05:34:06PM -0800, Josh Stone wrote:
> >> It might be worth auditing other qsort/tsearch comparison functions for
> >> similar wrapping possibilities.
> > 
> > I think you are right. I looked over all compare functions and two didn't
> > do as you suggest. The attached patch fixes those. Do that look correct?
> Those look good.

Thanks, pushed.

> I think src/elfcmp.c compare_Elf32_Word() is also wrong, as big u32
> values could wrap int subtraction.  I didn't find any others.

Ah, missed that Elf32_Word is unsigned. There is an assert that makes
sure it is at least as wide as an int, but that isn't enough indeed.

Proposed fix attached.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-elfcmp-Make-sure-Elf32_Word-difference-doesn-t-wrap-.patch
Type: text/x-patch
Size: 1246 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/elfutils-devel/attachments/20141216/78f1cf2f/attachment.bin>

More information about the elfutils-devel mailing list