aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDFTokenizer.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2019-01-31 21:51:52 +0100
committerJay Berkenbilt <ejb@ql.org>2019-02-01 02:28:44 +0100
commiteb49e07c0afc1b30b53d3ae2849c824c9407f00d (patch)
treee7c73b1115fcd5b7ea3c62376cb10e680724fb1c /libqpdf/QPDFTokenizer.cc
parent5211bcb5eaa2b6b3c8aa48580f1b97314c37bb4a (diff)
downloadqpdf-eb49e07c0afc1b30b53d3ae2849c824c9407f00d.tar.zst
Make inline image token exactly contain the image data
Do not include the trailing EI, and handle cases where EI is not preceded by a delimiter. Such cases have been seen in the wild.
Diffstat (limited to 'libqpdf/QPDFTokenizer.cc')
-rw-r--r--libqpdf/QPDFTokenizer.cc11
1 files changed, 1 insertions, 10 deletions
diff --git a/libqpdf/QPDFTokenizer.cc b/libqpdf/QPDFTokenizer.cc
index 2671fcbb..80fcf347 100644
--- a/libqpdf/QPDFTokenizer.cc
+++ b/libqpdf/QPDFTokenizer.cc
@@ -73,15 +73,6 @@ QPDFWordTokenFinder::check()
// beginning of the input.
return false;
}
- is->seek(token_start - 1, SEEK_SET);
- char prev;
- bool prev_okay = ((is->read(&prev, 1) == 1) && is_delimiter(prev));
- is->seek(pos, SEEK_SET);
- if (! prev_okay)
- {
- QTC::TC("qpdf", "QPDFTokenizer finder word not preceded by delimiter");
- return false;
- }
return true;
}
@@ -724,7 +715,7 @@ QPDFTokenizer::findEI(PointerHolder<InputSource> input)
{
break;
}
- this->m->inline_image_bytes = input->tell() - pos;
+ this->m->inline_image_bytes = input->tell() - pos - 2;
QPDFTokenizer check;
bool found_bad = false;