summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2013-07-01 19:53:05 +0000
committerfrosch <frosch@openttd.org>2013-07-01 19:53:05 +0000
commite8b6d2b32dd55d6aeb9c302ca62464e8c36d93fa (patch)
treeffcb04c649efb5436e015014b7a1502cd2507f9a
parentd9065fbfbe567a621e4d5051494ca76f1bbd36d5 (diff)
downloadopenttd-e8b6d2b32dd55d6aeb9c302ca62464e8c36d93fa.tar.xz
(svn r25551) -Fix (r25465): Possible reading of uninitialised memory due to undefined execution order.
-rw-r--r--src/gfx_layout.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gfx_layout.cpp b/src/gfx_layout.cpp
index 6ce6078eb..114c5c3e6 100644
--- a/src/gfx_layout.cpp
+++ b/src/gfx_layout.cpp
@@ -319,7 +319,8 @@ ParagraphLayout::Line *ParagraphLayout::nextLine(int max_width)
}
if (this->buffer == next_run) {
- *l->Append() = new VisualRun(iter->second, begin, this->buffer - begin, l->getWidth());
+ int w = l->getWidth();
+ *l->Append() = new VisualRun(iter->second, begin, this->buffer - begin, w);
iter++;
assert(iter != this->runs.End());
@@ -365,7 +366,8 @@ ParagraphLayout::Line *ParagraphLayout::nextLine(int max_width)
}
if (l->Length() == 0 || last_char - begin != 0) {
- *l->Append() = new VisualRun(iter->second, begin, last_char - begin, l->getWidth());
+ int w = l->getWidth();
+ *l->Append() = new VisualRun(iter->second, begin, last_char - begin, w);
}
return l;
}