From c329d59b16b89f3533f9d309ed297938af865ae0 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Mon, 17 Apr 2017 13:08:36 -0700 Subject: Fix buffer management issues in CFX_SAXReader. Re-write to use std::vectors rather than self-managed buffers. Includes test case that breaks before patch. Formerly, we had two independent buffers whose position were tracked by the same variable, assuming that only one was being written to at a given time. This is a bad idea because it's easy to forget to zero the index when switching buffers, and start indexing into one using previously computed offsets from the other. Additionally, there were cases where the location of a partial entity wasn't discarded when switching states thus clearing the buffer tracking said entity. Bug: 711459 Change-Id: I008f69517d4319a5fe8abda8d54c5b9975551697 Reviewed-on: https://pdfium-review.googlesource.com/4230 Reviewed-by: Lei Zhang Commit-Queue: Tom Sepez --- core/fxcrt/xml/cfx_saxreader_unittest.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'core/fxcrt/xml/cfx_saxreader_unittest.cpp') diff --git a/core/fxcrt/xml/cfx_saxreader_unittest.cpp b/core/fxcrt/xml/cfx_saxreader_unittest.cpp index f79b82c3cc..7865d0b77c 100644 --- a/core/fxcrt/xml/cfx_saxreader_unittest.cpp +++ b/core/fxcrt/xml/cfx_saxreader_unittest.cpp @@ -130,3 +130,21 @@ TEST_F(CFX_SAXReaderTest, TextWithinTag) { ASSERT_TRUE(StartParse(data)); EXPECT_EQ(100, ContinueParse()); } + +TEST_F(CFX_SAXReaderTest, bug_711459) { + char data[] = + "&ax;"; + ASSERT_TRUE(StartParse(data)); + EXPECT_EQ(100, ContinueParse()); +} -- cgit v1.2.3