-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
Am 2016-01-01 um 18:15 schrieb Aaryaman Vasishta:
expected = (info_header.biWidth + 3) & ~3;
ok(expected == img->bytes_per_line, "Expected bytes per line == %d, got %d.\n", expected, img->bytes_per_line);
if (depth == 8)
{
for (i = 0; i < h; i++)
{
offset = upside_down ? (img->bytes_per_line * (h - i - 1)) : (img->bytes_per_line * i);
for (j = 0; j < img->bytes_per_line; j++)
{
if (buffer1[k++] != buffer2[offset++])
return FALSE;
}
You want j < img->width here, otherwise you compare the padded bytes against the next line of the input image. (You'll then also compare the follow-up lines incorrectly and read past the input buffer). It works here because you pass an image with a width that's a multiple of 4 when this codepath is used.
So iterate over width pixels, but advance the read offset / pointer by bytes_per_line bytes after processing one line.