From 182b44ee37a0e3071c19f1a34300502fff70d860 Mon Sep 17 00:00:00 2001 From: Chun-Chen Hsu Date: Wed, 14 Mar 2018 10:03:03 +0800 Subject: [PATCH] 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 --- src/base/pngwriter.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); } -- 2.30.2