summaryrefslogtreecommitdiff
path: root/pdf/pdf_crypt.c
AgeCommit message (Collapse)Author
2012-12-20Bug 693503: Fix stack corruption in pdf_crypt due to overlong keyRobin Watts
If the key length is specified too long (0x120 for example), we can overrun the key buffer (32 bytes). Fix this with some explicit checks. Problem found in 2513.pdf.asan.73.1684, a test file supplied by Mateusz "j00ru" Jurczyk and Gynvael Coldwind of the Google Security Team using Address Sanitizer. Many thanks!
2012-12-14Bug 693503: Fix SEGV/memory problems in AES.Robin Watts
If an illegal keysize is passed into the AES crypt filter, we currently exit without setting up the AES context. This causes us to fail in all manner of ways later on. We now return failure and callers throw an exception. This appears to solve all the SEGVs and memory exceptions found in crypt_aes by Mateusz "j00ru" Jurczyk and Gynvael Coldwind of the Google Security Team using Address Sanitizer. Many thanks!
2012-08-16Adjust out of range tests for encryption key lengthsSebastian Rasmussen
Encryption keys for rev. 4 and prior may at most be 128-bits. Encryption keys for rev. 5/6 may only be 256-bits long Thanks to zeniko for pointing this out.
2012-08-16Add PDF 1.7 ExtensionLevel 8 encryption algorithmSebastian Rasmussen
Thanks to zeniko for implementing the algorithm.
2012-08-12Fix comparison typo in encryption codeSebastian Rasmussen
2012-08-06Expose both PDF encryption version and revisionSebastian Rasmussen
Thanks to Zeniko for pointing out that version as missing.
2012-08-06No need to check for NULL before dropping objectsSebastian Rasmussen
2012-07-23Fix encryption key length checkSebastian Rasmussen
Encryption keys lengths are expressed in bits, however one check assumed the length was expressed in bytes.
2012-07-06Remove unnecessary check for unsupported crypt revision.Sebastian Rasmussen
2012-07-06Improve bounds checking of encryption key lengthSebastian Rasmussen
2012-07-06Reorder parsing of encryption dict.Sebastian Rasmussen
2012-07-06Make length check for crypt dict entries similar.Sebastian Rasmussen
2012-07-06Defer dereferencing of pdf_crypt until it's needed.Sebastian Rasmussen
2012-07-06Remove debugging functions for release builds.Sebastian Rasmussen
2012-03-13Rename some functions and accessors to be more consistent.Tor Andersson
Debug printing functions: debug -> print. Accessors: get noun attribute -> noun attribute. Find -> lookup when the returned value is not reference counted. pixmap_with_rect -> pixmap_with_bbox. We are reserving the word "find" to mean lookups that give ownership of objects to the caller. Lookup is used in other places where the ownership is not transferred, or simple values are returned. The rename is done by the sed script in scripts/rename3.sed
2012-03-06Split fitz.h/mupdf.h into internal/external headers.Robin Watts
Attempt to separate public API from internal functions.
2012-03-06Warn instead of throw when permissions are missing in encrypted PDF.Sebastian Rasmussen
2012-03-06Guess encryption revision from the version if missing.Sebastian Rasmussen
2012-02-26Move fz_obj to be pdf_obj.Robin Watts
Currently, we are in the slightly strange position of having the PDF specific object types as part of fitz. Here we pull them out into the pdf layer instead. This has been made possible by the recent changes to make the store no longer be tied to having fz_obj's as keys. Most of this work is a simple huge rename; to help customers who may have code that use such functions we have provided a sed script to do the renaming; scripts/rename2.sed. Various other small tweaks are required; the store used to have some debugging code that still required knowledge of fz_obj types - we extract that into a nicer 'type' based function pointer. Also, the type 3 font handling used to have an fz_obj pointer for type 3 resources, and therefore needed to know how to free this; this has become a void * with a function to free it.
2012-02-03Make fz_malloc_struct return zeroed memory.Tor Andersson
2012-01-27Rename pdf_xref type to pdf_document.Tor Andersson
2012-01-19Remove confusing optional 'password' argument to pdf_open_xref.Tor Andersson
Require that clients call pdf_needs_password/pdf_authenticate_password instead. For dumb clients, we still allow for decrypting a file with a blank password without calling those functions.
2012-01-11Stylistic comment and whitespace fixes.Tor Andersson
2012-01-10Fix many spelling errors.Sebastian Rasmussen
2011-12-16Add fz_malloc_struct, and make code use it.Robin Watts
The new fz_malloc_struct(A,B) macro allocates sizeof(B) bytes using fz_malloc, and then passes the resultant pointer to Memento_label to label it with "B". This costs nothing in non-memento builds, but gives much nicer listings of leaked blocks when memento is enabled.
2011-12-08Stylistic changes when testing pointer values for NULL.Tor Andersson
Also: use 'cannot' instead of 'failed to' in error messages.
2011-12-08Remove remaining fz_error_note calls in the pdf code.Tor Andersson
2011-11-25Merge branch 'master' into contextRobin Watts
2011-11-17AES encryption tweak; strings can be 0 bytes longRobin Watts
Do not emit a warning if AES strings are 0 bytes long.
2011-10-04Move to exception handling rather than error passing throughout.Robin Watts
This frees us from passing errors back everywhere, and hence enables us to pass results back as return values. Rather than having to explicitly check for errors everywhere and bubble them, we now allow exception handling to do the work for us; the downside to this is that we no longer emit as much debugging information as we did before (though this could be put back in). For now, the debugging information we have lost has been retained in comments with 'RJW:' at the start. This code needs fuller testing, but is being committed as a work in progress.
2011-09-21Add warning context.Tor Andersson
2011-09-21Don't thread ctx through safe fz_obj functions.Tor Andersson
2011-09-15Add context to mupdf.Robin Watts
Huge pervasive change to lots of files, adding a context for exception handling and allocation. In time we'll move more statics into there. Also fix some for(i = 0; i < function(...); i++) calls.
2011-09-14Initial import of exception handling codeRobin Watts
Import exception handling code from WSS, modified to fit into the fitz world. With this code we have 'real' fz_try/fz_catch/fz_rethrow functions, handling a fz_except type. We therefore rename the existing fz_throw/ fz_catch/fz_rethrow to be fz_error_make/fz_error_handle/fz_error_note. We don't actually use fz_try/fz_catch/fz_rethrow yet...
2011-09-02Relax length requirements of ID and U keys in encryption dictionaries.Tor Andersson
2011-07-29Bug 692382: Fix typo that broke encryption support.Robin Watts
Not quite sure how this one slipped through - must add encrypted documents to the mupdf test suite.
2011-06-14Fix Bug 692277: PDF file won't open.Robin Watts
Acrobat (and gs, see bug 690478) will open a file without a CF dictionary by assuming that the encryption type is RC4. Mirror this in mupdf.
2011-04-25Check AES encrypted string length and padding values.Tor Andersson
2011-04-14Expose informational encryption details.Tor Andersson
2011-04-10Make crypt struct opaque.Tor Andersson
2011-04-10Make fz_obj struct opaque.Tor Andersson
2011-04-04Le Roi est mort, vive le Roi!Tor Andersson
The run-together words are dead! Long live the underscores! The postscript inspired naming convention of using all run-together words has served us well, but it is now time for more readable code. In this commit I have also added the sed script, rename.sed, that I used to convert the source. Use it on your patches and application code.
2011-04-04pdf: Rename mupdf directory.Tor Andersson