bspatch: Add a sanity-check for malformed patches.

This patch adds an extra sanity-check for malformed patches. A
corrupted patch should be cached by update_engine before reaching
this step anyway.

TEST=emerge-link bsdiff && chroot/build/link/usr/bin/bspatch foo bar malformed_patch
bspatch segfaults without the patch and shows the error message with it.

Change-Id: I8007b41cf3ab6558a99ffd6085e382f1c32f9bdf
Tested-by: Alex Deymo <>
Reviewed-by: Jorge Lucangeli Obes <>
Commit-Queue: Alex Deymo <>
1 file changed