mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-03-01 18:45:10 +08:00
check return value from zlib inflateInit2...
This commit is contained in:
parent
44fae6e600
commit
a89ae9cb35
3 changed files with 10 additions and 4 deletions
|
@ -229,8 +229,10 @@ static bool reset_fpga_stream(int bitstream_version, z_streamp compressed_fpga_s
|
|||
compressed_fpga_stream->zalloc = &fpga_inflate_malloc;
|
||||
compressed_fpga_stream->zfree = &fpga_inflate_free;
|
||||
|
||||
inflateInit2(compressed_fpga_stream, 0);
|
||||
|
||||
int res = inflateInit2(compressed_fpga_stream, 0);
|
||||
if ( res < 0 )
|
||||
return false;
|
||||
|
||||
fpga_image_ptr = output_buffer;
|
||||
|
||||
for (uint16_t i = 0; i < FPGA_BITSTREAM_FIXED_HEADER_SIZE; i++)
|
||||
|
|
|
@ -48,7 +48,9 @@ static void uncompress_data_section(void) {
|
|||
data_section.opaque = NULL;
|
||||
|
||||
// initialize zlib for inflate
|
||||
inflateInit2(&data_section, 15);
|
||||
int res = inflateInit2(&data_section, 15);
|
||||
if ( res < 0 )
|
||||
return;
|
||||
|
||||
// uncompress data segment to RAM
|
||||
inflate(&data_section, Z_FINISH);
|
||||
|
|
|
@ -206,7 +206,9 @@ int zlib_decompress(FILE *infile, FILE *outfile) {
|
|||
compressed_fpga_stream.opaque = Z_NULL;
|
||||
|
||||
ret = inflateInit2(&compressed_fpga_stream, 0);
|
||||
|
||||
if ( res < 0 )
|
||||
return (EXIT_FAILURE);
|
||||
|
||||
do {
|
||||
if (compressed_fpga_stream.avail_in == 0) {
|
||||
compressed_fpga_stream.next_in = inbuf;
|
||||
|
|
Loading…
Reference in a new issue