libelf: Check compression ratio before trying to allocate output buffer.

The maximum compression factor (http://www.zlib.net/zlib_tech.html) is
1032:1. Add a sanity check for that before trying to allocate lots of
memory and trying to decompress lots of bogus data.

https://sourceware.org/bugzilla/show_bug.cgi?id=21301

Signed-off-by: Mark Wielaard <mark@klomp.org>
2 files changed