|
From: Bart V. A. <bva...@ac...> - 2011-06-17 16:02:22
|
On Fri, Jun 17, 2011 at 5:45 PM, Stephanie Stroka
<ste...@sa...> wrote:
>
> My code at that position looks like this:
>
> 284 static uint* sort(uint** matrix, uint width, uint height) {
> 285 uint* data = (uint*) malloc(width * height * sizeof(uint));
> 286 uint i,j=0;
> 287 for(i=0; i<height; i++) {
> 288 for(j=0; j<width; j++) {
> 289 data[j + i*height] = matrix[i][j];
> 290 }
> 291 }
The above won't crash if height is less than or equal to width, but if
height is larger than width it will crash. Haven't you noticed yet
what is wrong with the above code ?
Bart.
|