nbis: Fix crash in gen_initial_maps()
If the image is too small some coordinates can become negative. Handle this to avoid memory corruption. https://bugs.freedesktop.org/show_bug.cgi?id=57730
This commit is contained in:
parent
258ac2d4da
commit
a7d6b7c30a
1 changed files with 4 additions and 0 deletions
|
@ -307,6 +307,10 @@ int gen_initial_maps(int **odmap, int **olcmap, int **olfmap,
|
|||
xmaxlimit = pw - dftgrids->pad - lfsparms->windowsize - 1;
|
||||
ymaxlimit = ph - dftgrids->pad - lfsparms->windowsize - 1;
|
||||
|
||||
/* max limits should not be negative */
|
||||
xmaxlimit = MAX(xmaxlimit, 0);
|
||||
ymaxlimit = MAX(ymaxlimit, 0);
|
||||
|
||||
/* Foreach block in image ... */
|
||||
for(bi = 0; bi < bsize; bi++){
|
||||
/* Adjust block offset from pointing to block origin to pointing */
|
||||
|
|
Loading…
Reference in a new issue