libarchive/libarchive — pull request #26 by cmdrclueless (2012-09-26 05:47:06+00:00)
Title: Add tighter checks to avoid reading past end of buffer

This is a second attempt at the patch. I successfully ran the test suite against
the changes with only one error regarding a corrupt compressed stream:

`57: test_fuzz unxz: (stdin): Compressed data is corrupt`

In the previous attempt the first character decrement was done even if the
required character match didn't occur. This resulted in processing to *little*
of the buffer. I tried to avoid any character decrements in the loop checks
to avoid a repeat of the previous logic flaw.

The string to base 8/10 conversion routines could read past the
counted end of the buffer if the string is correctly formated.
The number of characters is now checked and decremented for every
character that is consumed for processing.

successfully passes 'make check-TESTS'