Add missing dependencies back into VS2005 project.

Lost as part of the accidental VS2012 change.
Bug 694897: Fix valgrind issues with versions

If the /Version is a single character string (say "s") then the
current code for converting this in pdf_init_document reads off
the end of the string.

Simple fix is to use fz_atof instead.

Same fix for reading the PDF version normally.

This solves:

  53b830f849d028fb2d528520716e157a_asan_heap-oob_478692_5259_4534.pdf

Thanks to Mateusz Jurczyk and Gynvael Coldwind of the Google Security
Team for providing the example files.
Bug 694896: Ensure that repairs don't lose trailer dict.

When we find certain classes of flaw in the file while attempting to
read an object, we trigger an automatic repair of the file. This
leaves almost all objects unchanged; the sole exception is that of
the trailer object (and its sub objects) which can get dropped and
recreated.

To avoid leaving people holding handles to objects within the trailer
dict high and dry, we introduce a 'pre_repair_trailer' object to
each xref entry. On a repair, we copy the existing trailer object to
this. As we only ever repair once, this is safe.

The only known place where this is a problem is when setting up the
pdf_crypt for a document; we adapt the code here to allow for
potential problems.

The example file that shows this up is:

  048d14d2f5f0ae31e9a2cde0be66f16a_asan_heap-uaf_86d4ed_3961_3661.pdf

Thanks to Mateusz Jurczyk and Gynvael Coldwind of the Google Security
Team for providing the fuzzing files.
Fix more Memento/Valgrind interactions.

Seen when valgrinding a memento build of mudraw on:

  e0e44ed8692671b820de72c6c0a32608_asan_heap-uaf_8c2b76_1530_2026.pdf
Avoid overflows in floating point causing illegal accesses

If the scale is too large, the calculation to determine the
required size of a pixmap can overflow. This can lead to negative
width/heights being passed in, which confuses the subsampling
code, leading to SEGVs.
Bug 694899: Avoid using invalid gstate pointer.

When we call pdf_begin_group, this can go away and do lots of
drawing. This can result in the gstate stack growing, which can
involve a realloc. Any gstate pointer we are holding must therefore
be recalculated after such a call.

The neatest way to do this is to get pdf_begin_group to return
the gstate pointer, thus making it hard to forget to do.

This solves:

  e2a1dda5393f4cb8a446fd8edd9d94f9_asan_heap-uaf_b938cf_2075_2393.pdf

Thanks to Mateusz Jurczyk and Gynvael Coldwind of the Google Security
Team for providing the example files.
Take on JBIG2Dec and OpenJPEG fixes from ghostscript.