From: Chun-Chen Hsu Date: Wed, 14 Mar 2018 02:03:03 +0000 (+0800) Subject: base: Fix loop range in pngwriter X-Git-Tag: v19.0.0.0~2237 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=182b44ee37a0e3071c19f1a34300502fff70d860;p=gem5.git base: Fix loop range in pngwriter The inner loop range limit should be width instead of height. Change-Id: I091c590713c945d4bd04ffcc974d4eb8aa23d1b2 Signed-off-by: Chun-Chen Hsu Reviewed-on: https://gem5-review.googlesource.com/9081 Maintainer: Andreas Sandberg Reviewed-by: Jason Lowe-Power --- diff --git a/src/base/pngwriter.cc b/src/base/pngwriter.cc index 3251ac885..9faf23c24 100644 --- a/src/base/pngwriter.cc +++ b/src/base/pngwriter.cc @@ -160,7 +160,7 @@ PngWriter::write(std::ostream &png) const // libpng requires an array of pointers to the frame buffer's rows. std::vector 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); }