Opened 6 years ago

Closed 6 years ago

#11748 closed bug (no change required)

CID 20155: Negative array index read

Reported by: sli908 Owned by: nobody
Priority: normal Milestone: R1
Component: - General Version: R1/Development
Keywords: gci2014 Cc:
Blocked By: Blocking:
Platform: All


Added a check on the array index variable to prevent accessing a negative index

Attachments (1)

0001-CID-20155-Negative-array-index-read-Added-negative-i.patch (902 bytes ) - added by sli908 6 years ago.
Patch that adds index check

Download all attachments as: .zip

Change History (4)

by sli908, 6 years ago

Patch that adds index check

comment:1 by sli908, 6 years ago

patch: 01

comment:2 by pulkomandy, 6 years ago

This fix is wrong. cnt can't be negative (it is initialized to 0 and then incremented only). Apparently the useless condition in the return statement confuses coverity, and this statement should be fixed.

Since this code is actually from gawk/libintl, it would be easier to look at a current version of that and see if the code was already fixed there.

comment:3 by umccullough, 6 years ago

Resolution: no change required
Status: newclosed

Whether the patch is correct or not, I think we probably won't be applying it to our in-tree gawk code since it's 3rd party (I'm surprised we haven't externalized this yet).

Note: See TracTickets for help on using tickets.