Opened 11 years ago
Last modified 11 years ago
#5203 closed defect
Implicit signed-to-unsigned conversions in rasterfill.cpp — at Initial Version
Reported by: | akhliustov | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | 1.10.1 |
Component: | Algorithms | Version: | unspecified |
Severity: | normal | Keywords: | |
Cc: |
Description
if( iY - panLastY[iX] <= dfMaxSearchDist )
panLastY[iX]
is unsigned, so iY - panLastY[iX]
is unsigned too. If iY < panLastY[iX]
, their "difference" is a large positive number that can be greater than dfMaxSearchDist
. In that case the condition evaluates to false
, which is (probably) not expected.
- http://trac.osgeo.org/gdal/browser/trunk/gdal/alg/rasterfill.cpp#L333
double dfDistSq = ((target_x-origin_x) * (target_x-origin_x)) + ((target_y-origin_y) * (target_y-origin_y));
Heretarget_y
is unsigned, so the whole right-hand expression uses unsigned arithmetics. Iftarget_x < origin_x
ortarget_y < origin_y
, it leads to a totally wrong result.
Note:
See TracTickets
for help on using tickets.