mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:37:44 +00:00
LibPDF: Ensure that xref subsection numbers are u32
Previously, parsing an xref entry with a floating point subsection number would cause a crash.
This commit is contained in:
parent
d2f3288666
commit
459fa8b840
1 changed files with 4 additions and 1 deletions
|
@ -499,9 +499,12 @@ PDFErrorOr<NonnullRefPtr<XRefTable>> DocumentParser::parse_xref_table()
|
||||||
Vector<XRefEntry> entries;
|
Vector<XRefEntry> entries;
|
||||||
|
|
||||||
auto starting_index_value = TRY(parse_number());
|
auto starting_index_value = TRY(parse_number());
|
||||||
auto starting_index = starting_index_value.get<int>();
|
|
||||||
auto object_count_value = TRY(parse_number());
|
auto object_count_value = TRY(parse_number());
|
||||||
|
if (!(starting_index_value.has_u32() && object_count_value.has_u32()))
|
||||||
|
return error("Malformed xref entry");
|
||||||
|
|
||||||
auto object_count = object_count_value.get<int>();
|
auto object_count = object_count_value.get<int>();
|
||||||
|
auto starting_index = starting_index_value.get<int>();
|
||||||
|
|
||||||
for (int i = 0; i < object_count; i++) {
|
for (int i = 0; i < object_count; i++) {
|
||||||
auto offset_string = ByteString(m_reader.bytes().slice(m_reader.offset(), 10));
|
auto offset_string = ByteString(m_reader.bytes().slice(m_reader.offset(), 10));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue