mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 03:07:44 +00:00
LibPDF/CFF: Fix off-by-one when reading internal encoding
We use `i - 1` to index these arrays, so that's what we should use for the bounds check as well.
This commit is contained in:
parent
abaca60f9a
commit
4705d38fa7
1 changed files with 2 additions and 1 deletions
|
@ -279,8 +279,9 @@ PDFErrorOr<NonnullRefPtr<CFF>> CFF::create(ReadonlyBytes const& cff_bytes, RefPt
|
|||
encoding->set(0, ".notdef");
|
||||
continue;
|
||||
}
|
||||
if (i >= encoding_codes.size() || i >= charset_names.size())
|
||||
if (i - 1 >= encoding_codes.size() || i - 1 >= charset_names.size()) {
|
||||
break;
|
||||
}
|
||||
auto code = encoding_codes[i - 1];
|
||||
auto char_name = charset_names[i - 1];
|
||||
encoding->set(code, char_name);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue