Gnash - The GNU Flash player - Patches: patch #7533, [PATCH] AbcBlock.h: checkBounds...
You are not allowed to post comments on this tracker with your current authentication level.
patch #7533: [PATCH] AbcBlock.h: checkBounds should check for negative values
Submitter: | Mj Mendoza IV <creek23> | ||
Submitted: | Tue 26 Apr 2011 04:03:18 AM UTC | ||
Category: | core | Priority: | 3 - Low |
Status: | None | Privacy: | Public |
Assigned to: | None | Open/Closed: | Open |
Wed 27 Apr 2011 08:12:19 AM UTC, comment #3: |
Sandro Santilli <strk>![]() |
Wed 27 Apr 2011 03:11:52 AM UTC, comment #2: I believe so, but I'm only trying to address a TODO inside `libcore/vm/Machine.cpp' at line 64:
|
Mj Mendoza IV <creek23> |
Tue 26 Apr 2011 10:08:40 AM UTC, comment #1: Isn't size_t unsigned ?
|
Sandro Santilli <strk>![]() |
Tue 26 Apr 2011 04:03:18 AM UTC, original submission:
There might be a chance that malformed values could be negative. |
Mj Mendoza IV <creek23> |
Depends on the following items: None found
Items that depend on this one: None found
There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.
Follow 2 latest changes.
Date | Changed by | Updated Field | Previous Value | => | Replaced by |
---|---|---|---|---|---|
2011-04-26 | creek23 | Attached File | - | ![]() |
Added AbcBlock.h.patch, #23304 |
Attached File | - | ![]() |
Added AbcBlock.h.patch.htm, #23305 |
The point is that if size_t can't be negative there's no point in checking for it to be < 0.
The compiler should notice that and warn you with something like: "comparison will always be false". Please check if it does.
If a caller tries to pass a negative number to a function expecting an unsigned type the body of the funcion will see that value reinterpreted as a positive value, which usually gets evaluated as > [maxvalue].
If a check has to be made for negative values it should be made outside of the function, that is while the value is still signed, right after reading it from the stack...