bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#28120: [PATCH] ptx: fix a possible crash caused by integer overflow


From: Paul Eggert
Subject: bug#28120: [PATCH] ptx: fix a possible crash caused by integer overflow
Date: Thu, 17 Aug 2017 12:14:05 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

On 08/17/2017 04:40 AM, Kamil Dudka wrote:
-typedef short int DELTA;       /* to hold displacement within one context */
+typedef int DELTA;             /* to hold displacement within one context */

Thanks for the heads-up. Although that fixes things for that particular test case, it won't work for larger cases. The type should be ptrdiff_t instead of int.

As its FIXME comment says, ptx is riddled with integer-overflow bugs. I installed the attached patch to fix the bug that you mentioned along with the other low-hanging fruit that I found, and am marking the bug as fixed upstream. I expect some other integer-overflow bugs can still occur in practice, but at least this patch is a significant improvement.

This patch prefers signed integer types like ptrdiff_t to unsigned types like size_t, as signed types allow for better checking when compiled with sanitization.

Attachment: 0001-ptx-fix-some-integer-overflow-bugs.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]