Commit a7d6b7c3 authored by Vasily Khoruzhick's avatar Vasily Khoruzhick Committed by Bastien Nocera

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
parent 258ac2d4
......@@ -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 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment