|
|
75a61b |
From e2a8d2c149988a96fec0dc0ec38001091cd9061e Mon Sep 17 00:00:00 2001
|
|
|
75a61b |
From: Jason Crain <jason@aquaticape.us>
|
|
|
75a61b |
Date: Fri, 19 Dec 2014 01:56:45 -0600
|
|
|
75a61b |
Subject: [PATCH] Move array reallocation from visitLine to startLine
|
|
|
75a61b |
|
|
|
75a61b |
Fixes potential memory corruption from writing after end of lines
|
|
|
75a61b |
array.
|
|
|
75a61b |
|
|
|
75a61b |
https://bugs.freedesktop.org/show_bug.cgi?id=84555
|
|
|
75a61b |
---
|
|
|
75a61b |
poppler/TextOutputDev.cc | 10 +++++-----
|
|
|
75a61b |
1 file changed, 5 insertions(+), 5 deletions(-)
|
|
|
75a61b |
|
|
|
75a61b |
diff --git a/poppler/TextOutputDev.cc b/poppler/TextOutputDev.cc
|
|
|
75a61b |
index 4b7ff40..9ed955e 100644
|
|
|
75a61b |
--- a/poppler/TextOutputDev.cc
|
|
|
75a61b |
+++ b/poppler/TextOutputDev.cc
|
|
|
75a61b |
@@ -4072,6 +4072,11 @@ void TextSelectionDumper::startLine()
|
|
|
75a61b |
|
|
|
75a61b |
void TextSelectionDumper::finishLine()
|
|
|
75a61b |
{
|
|
|
75a61b |
+ if (nLines == linesSize) {
|
|
|
75a61b |
+ linesSize *= 2;
|
|
|
75a61b |
+ lines = (GooList **)grealloc(lines, linesSize * sizeof(GooList *));
|
|
|
75a61b |
+ }
|
|
|
75a61b |
+
|
|
|
75a61b |
if (words && words->getLength() > 0)
|
|
|
75a61b |
lines[nLines++] = words;
|
|
|
75a61b |
else if (words)
|
|
|
75a61b |
@@ -4088,11 +4093,6 @@ void TextSelectionDumper::visitLine (TextLine *line,
|
|
|
75a61b |
{
|
|
|
75a61b |
TextLineFrag frag;
|
|
|
75a61b |
|
|
|
75a61b |
- if (nLines == linesSize) {
|
|
|
75a61b |
- linesSize *= 2;
|
|
|
75a61b |
- lines = (GooList **)grealloc(lines, linesSize * sizeof(GooList *));
|
|
|
75a61b |
- }
|
|
|
75a61b |
-
|
|
|
75a61b |
frag.init(line, edge_begin, edge_end - edge_begin);
|
|
|
75a61b |
|
|
|
75a61b |
if (tableId >= 0 && frag.line->blk->tableId < 0) {
|
|
|
75a61b |
--
|
|
|
75a61b |
2.1.3
|
|
|
75a61b |
|