This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [BUILDROBOT, PATCH] Fix sign-compare in dwarf.c


On Wed, 2014-11-19 21:26:10 +1030, Alan Modra <amodra@gmail.com> wrote:
> On Tue, Nov 18, 2014 at 10:08:18PM +0100, Jan-Benedict Glaw wrote:
> > -  if (len == 0 || data == end || len > (end - data))
> > +  if (len == 0 || data == end || len > (unsigned int) (end - data))
> 
> Strictly speaking that is the wrong cast.
> 
>   if (len == 0 || len > (uintptr_t) (end - data))

Quite right!  I tested that as well and committed:



2014-11-18  Jan-Benedict Glaw  <jbglaw@lug-owl.de>

binutils/
	* dwarf.c (process_extended_line_op): Fix signedness warning.

 
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index e1e2b35..7f3a568 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -416,7 +416,7 @@ process_extended_line_op (unsigned char * data,
   len = read_uleb128 (data, & bytes_read, end);
   data += bytes_read;
 
-  if (len == 0 || data == end || len > (end - data))
+  if (len == 0 || data == end || len > (uintptr_t) (end - data))
     {
       warn (_("Badly formed extended line op encountered!\n"));
       return bytes_read;


MfG, JBG

-- 
      Jan-Benedict Glaw      jbglaw@lug-owl.de              +49-172-7608481
Signature of:         "really soon now":      an unspecified period of time, likly to
the second  :                                 be greater than any reasonable definition
                                              of "soon".

Attachment: signature.asc
Description: Digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]