From 31372edce0b60211c7af98340b3afa054f414ca4 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Wed, 30 Jan 2019 14:14:46 -0500 Subject: Inline image token value ends with EI, not delimiter The inline image token erroneously included the delimiter that followed EI. The ObjectHandle created from it was correct. --- libqpdf/QPDFTokenizer.cc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'libqpdf/QPDFTokenizer.cc') diff --git a/libqpdf/QPDFTokenizer.cc b/libqpdf/QPDFTokenizer.cc index e1399d82..c11c8218 100644 --- a/libqpdf/QPDFTokenizer.cc +++ b/libqpdf/QPDFTokenizer.cc @@ -468,6 +468,7 @@ QPDFTokenizer::presentCharacter(char ch) } else if (this->m->state == st_inline_image) { + this->m->val += ch; size_t len = this->m->val.length(); if ((len >= 4) && isDelimiter(this->m->val.at(len-4)) && @@ -475,22 +476,18 @@ QPDFTokenizer::presentCharacter(char ch) (this->m->val.at(len-2) == 'I') && isDelimiter(this->m->val.at(len-1))) { + this->m->val.erase(len - 1); this->m->type = tt_inline_image; this->m->unread_char = true; this->m->char_to_unread = ch; this->m->state = st_token_ready; } - else - { - this->m->val += ch; - } } else { handled = false; } - if (handled) { // okay -- cgit v1.2.3-54-g00ecf