[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] [patch #7533] [PATCH] AbcBlock.h: checkBounds should chec
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] [patch #7533] [PATCH] AbcBlock.h: checkBounds should check for negative values |
Date: |
Wed, 27 Apr 2011 08:12:19 +0000 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Ubuntu/10.04 Chromium/10.0.648.205 Chrome/10.0.648.205 Safari/534.16 |
Follow-up Comment #3, patch #7533 (project gnash):
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...
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/patch/?7533>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/