[cairo-bugs] [Bug 100029] New: Broken pdf/ps output due to badly placed newline
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Thu Mar 2 02:51:08 UTC 2017
https://bugs.freedesktop.org/show_bug.cgi?id=100029
Bug ID: 100029
Summary: Broken pdf/ps output due to badly placed newline
Product: cairo
Version: unspecified
Hardware: Other
OS: All
Status: NEW
Severity: normal
Priority: medium
Component: pdf backend
Assignee: ajohnson at redneon.com
Reporter: jmmorlan at sonic.net
QA Contact: cairo-bugs at cairographics.org
Created attachment 130021
--> https://bugs.freedesktop.org/attachment.cgi?id=130021&action=edit
Patch
In src/cairo-pdf-operators.c, _word_wrap_stream_write might insert a newline
into the output of _cairo_pdf_operators_emit_glyph_string_with_positioning in
the middle of an escape sequence and result in a broken PDF (or PS) file.
The code responsible for this:
if (*data == '\n' || stream->column >= stream->max_column) {
_cairo_output_stream_printf (stream->output, "\n");
stream->column = 0;
} else if (*data == '<') {
stream->state = WRAP_STATE_HEXSTRING;
} else if (*data == '(') {
stream->state = WRAP_STATE_STRING;
} else if (!_cairo_isspace (*data)) {
stream->state = WRAP_STATE_WORD;
}
When the "stream->column >= stream->max_column" case is hit, stream->state
doesn't get updated.
Here's a (simplified, purged of private information) example of how this can be
a problem:
[......................................................................27
(<)................................................................-713(\
()...]TJ
After "27(", the state didn't get changed to WRAP_STATE_STRING, so it got
incorrectly set to WRAP_STATE_HEXSTRING after the "<". The rest of the sequence
was wrapped with hex-string rules, and a newline was put in "-713(\()" exactly
where it shouldn't be.
--
You are receiving this mail because:
You are the QA Contact for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cairographics.org/archives/cairo-bugs/attachments/20170302/cde79630/attachment.html>
More information about the cairo-bugs
mailing list