Bug 12226 - binutils: readelf.c:11200: error: array subscript is above array bounds
Summary: binutils: readelf.c:11200: error: array subscript is above array bounds
Status: RESOLVED DUPLICATE of bug 11742
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.20
: P2 normal
Target Milestone: ---
Assignee: Alan Modra
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-18 01:26 UTC by John
Modified: 2010-11-18 07:49 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
Correct compiler error (288 bytes, patch)
2010-11-18 01:26 UTC, John
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John 2010-11-18 01:26:51 UTC
Created attachment 5127 [details]
Correct compiler error

binutils:  2.20.1
gcc version 4.3.3 (GCC) 
platform:  AIX adatx028 3 5 000D1D5A4C00
powerpc-ibm-aix5.3.0.0

Got a "fatal" warning when building binutils-2.20.1:
readelf.c:11200: error: array subscript is above array bounds

11200:  while ((arch->arhdr.ar_name[j] != '/') && (j < 16))

This is a bug since the array index is being referenced *before* it is bounds checked.  The attached patch corrected this error and compilation completed.
Comment 1 Alan Modra 2010-11-18 07:49:12 UTC
Fixed already, but fix isn't ideal in that full ar_name won't be displayed.

*** This bug has been marked as a duplicate of bug 11742 ***