From fca9da419108a0b415bfcec9c1bcc960988aceae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20Offenh=C3=A4user?= Date: Tue, 21 Mar 2023 19:57:47 +0100 Subject: [PATCH] LibPDF: Don't consume anything other than EOL in Reader::consume_eol() This was previously a slightly confusing API. Even when there was no EOL marker at the current location, we would still consume one byte. It will now consume either EOL or nothing at all. --- Userland/Libraries/LibPDF/Reader.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibPDF/Reader.cpp b/Userland/Libraries/LibPDF/Reader.cpp index 7bef8d6b2d..c9fc720384 100644 --- a/Userland/Libraries/LibPDF/Reader.cpp +++ b/Userland/Libraries/LibPDF/Reader.cpp @@ -46,8 +46,11 @@ bool Reader::consume_eol() consume(2); return true; } - auto consumed = consume(); - return consumed == 0xd || consumed == 0xa; + if (matches_eol()) { + consume(); + return true; + } + return false; } bool Reader::consume_whitespace()