summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2015-05-08 19:07:33 +0100
committerSimon Tatham <anakin@pobox.com>2015-05-08 19:07:33 +0100
commit0a9497c46541e4d8d317b75cde4ac1f62e9affe8 (patch)
tree9dbe9fc02a577b4013db57d2d0481ad651ff51d7
parent6f1c6378cf01dd5d91c5dbcba987555bfbd029d5 (diff)
downloadhalibut-0a9497c46541e4d8d317b75cde4ac1f62e9affe8.zip
halibut-0a9497c46541e4d8d317b75cde4ac1f62e9affe8.tar.gz
halibut-0a9497c46541e4d8d317b75cde4ac1f62e9affe8.tar.bz2
halibut-0a9497c46541e4d8d317b75cde4ac1f62e9affe8.tar.xz
Fix an uninitialised variable in PDF font code.
Thanks to Paul Curtis for reporting that 'if (i != prev+1)' would be undefined on the first pass through this loop, because prev was never initialised beforehand. Initialise it to a safe value.
-rw-r--r--bk_pdf.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/bk_pdf.c b/bk_pdf.c
index 10b9fdd..c66b742 100644
--- a/bk_pdf.c
+++ b/bk_pdf.c
@@ -317,6 +317,8 @@ void pdf_backend(paragraph *sourceform, keywordlist *keywords,
objtext(font, "/Subtype /Type1\n");
objtext(font, "\n/Encoding <<\n/Type /Encoding\n/Differences [");
+ prev = 256; /* ensure we compare unequal in 1st iteration */
+
for (i = 0; i < 256; i++) {
char buf[20];
if (fe->vector[i] == NOGLYPH)