From 160f09ecc32f72c7c63227bb8a5036302d27bda0 Mon Sep 17 00:00:00 2001 From: Přemysl Janouch Date: Tue, 2 Oct 2018 23:17:15 +0200 Subject: Fix octal escapes --- pdf-simple-sign.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pdf-simple-sign.cpp b/pdf-simple-sign.cpp index 36afcf4..9366daa 100644 --- a/pdf-simple-sign.cpp +++ b/pdf-simple-sign.cpp @@ -136,12 +136,11 @@ struct pdf_lexer { if (eat_newline(ch)) continue; std::string octal; - if (*p && strchr(oct_alphabet, *p)) octal += *p++; - if (*p && strchr(oct_alphabet, *p)) octal += *p++; - if (*p && strchr(oct_alphabet, *p)) octal += *p++; - if (!octal.empty()) { - value += char(std::stoi(octal, nullptr, 8)); - continue; + if (ch && strchr(oct_alphabet, ch)) { + octal += ch; + if (*p && strchr(oct_alphabet, *p)) octal += *p++; + if (*p && strchr(oct_alphabet, *p)) octal += *p++; + ch = std::stoi(octal, nullptr, 8); } } } -- cgit v1.2.3-70-g09d2