base: Fix loop range in pngwriter
authorChun-Chen Hsu <chunchenhsu@google.com>
Wed, 14 Mar 2018 02:03:03 +0000 (10:03 +0800)
committerChun-Chen TK Hsu <chunchenhsu@google.com>
Wed, 14 Mar 2018 11:56:29 +0000 (11:56 +0000)
The inner loop range limit should be width instead of height.

Change-Id: I091c590713c945d4bd04ffcc974d4eb8aa23d1b2
Signed-off-by: Chun-Chen Hsu <chunchenhsu@google.com>
Reviewed-on: https://gem5-review.googlesource.com/9081
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
src/base/pngwriter.cc

index 3251ac8859dfe21debc6932c074b063f1583ad98..9faf23c241bbe6b04844ed4020d273201b73e287 100644 (file)
@@ -160,7 +160,7 @@ PngWriter::write(std::ostream &png) const
     // libpng requires an array of pointers to the frame buffer's rows.
     std::vector<PixelType> rowPacked(width);
     for (unsigned y=0; y < height; ++y) {
-        for (unsigned x=0; x < height; ++x) {
+        for (unsigned x=0; x < width; ++x) {
             rowPacked[x] = fb.pixel(x, y);
         }