1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-10-31 19:42:43 +00:00
serenity/Userland/Libraries/LibPDF
Nico Weber 39b2eed3f6 LibPDF: Do not crash on encrypted files that start unluckily
PDF files can be linearized. In that case, they start with a
"linearization dict" that stores the key `/Linearized` and the value
`1`. To check if a file is linearized, we just read the first dict, and
then checked if it has that key.

If the first object of a PDF was a stream with a compression filter
and the input PDF was encrypted and not linearized, then us trying to
decode the linearization dict could crash due to stream contents being
encrypted, decryption state not yet being initialized, and us trying
to decompress stream data before decrypting it.

To prevent this, disable uncompression when parsing the first object
to determine if it's a lineralization dictionary.

(A linearization dict never stores string values, so decryption
not yet being initialized is not a problem. Integer values aren't
encrypted in encrypted PDF files.)
2023-07-12 06:28:15 +02:00
..
Fonts LibGfx: Use AntiAliasingPainter::fill_path() for drawing font glyphs 2023-07-10 20:56:25 +02:00
CMakeLists.txt LibPDF: Refactor *Font classes 2023-02-24 20:16:50 +01:00
ColorSpace.cpp AK+Everywhere: Rename FlyString to DeprecatedFlyString 2023-01-09 23:00:24 +00:00
ColorSpace.h Everywhere: Remove needless trailing semi-colons after functions 2023-07-08 10:32:56 +01:00
CommonNames.cpp AK+Everywhere: Rename FlyString to DeprecatedFlyString 2023-01-09 23:00:24 +00:00
CommonNames.h LibPDF: Add accessor for the document's info dict 2023-07-10 17:49:07 +01:00
Document.cpp LibPDF: Make PDF version accessible on Document 2023-07-11 13:49:17 -04:00
Document.h LibPDF: Make PDF version accessible on Document 2023-07-11 13:49:17 -04:00
DocumentParser.cpp LibPDF: Do not crash on encrypted files that start unluckily 2023-07-12 06:28:15 +02:00
DocumentParser.h LibPDF: Make PDF version accessible on Document 2023-07-11 13:49:17 -04:00
Encoding.cpp LibPDF: Avoid unnecessary HashMap copy, mark other copies 2023-05-19 22:33:57 +02:00
Encoding.h LibPDF: Add char_code -> name mapping function 2023-02-08 19:47:15 +01:00
Encryption.cpp LibPDF: Remove a pointless template specialization 2023-07-12 06:28:15 +02:00
Encryption.h LibPDF: Remove a pointless template specialization 2023-07-12 06:28:15 +02:00
Error.h LibPDF: Add new error construction functions 2023-02-24 20:16:50 +01:00
Filter.cpp Everywhere: Remove needless trailing semi-colons after functions 2023-07-08 10:32:56 +01:00
Filter.h LibPDF: Improve error support for Filter class 2023-03-02 12:18:53 +01:00
Forward.h Everywhere: Remove unused includes of AK/StdLibExtras.h 2023-01-02 20:27:20 -05:00
Interpolation.cpp LibPDF: Add first interpolation methods 2022-12-10 10:49:03 +01:00
Interpolation.h LibPDF: Add first interpolation methods 2022-12-10 10:49:03 +01:00
Object.h LibPDF: Make Object::cast<T>() non-const 2023-02-21 00:54:04 +01:00
ObjectDerivatives.cpp AK+Everywhere: Rename FlyString to DeprecatedFlyString 2023-01-09 23:00:24 +00:00
ObjectDerivatives.h Everywhere: Remove needless trailing semi-colons after functions 2023-07-08 10:32:56 +01:00
Operator.h Everywhere: Remove unused DeprecatedString includes 2023-04-09 22:00:54 +02:00
Parser.cpp LibPDF: Do not crash on encrypted files that start unluckily 2023-07-12 06:28:15 +02:00
Parser.h LibPDF: Do not crash on encrypted files that start unluckily 2023-07-12 06:28:15 +02:00
Reader.cpp LibPDF: Don't consume anything other than EOL in Reader::consume_eol() 2023-03-22 09:04:00 +01:00
Reader.h LibPDF: Add Reader::try_read for easier error propagation 2023-01-25 15:40:11 +01:00
Reference.h LibPDF: Make Reference store two u32s instead of one 2023-07-10 17:48:15 +01:00
Renderer.cpp LibPDF: Scale vector paths with the view 2023-03-25 16:27:30 -06:00
Renderer.h LibPDF: Allow show_text to return errors 2023-02-24 20:16:50 +01:00
Value.cpp Everywhere: Stop shoving things into ::std and mentioning them as such 2022-12-14 11:44:32 +01:00
Value.h Everywhere: Stop shoving things into ::std and mentioning them as such 2022-12-14 11:44:32 +01:00
XRefTable.h LibPDF: Allow reading documents with incremental updates 2023-02-12 10:55:37 +00:00