From a5001de76c8d3bfe5e6fe48363e547ccd0e70c94 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Sat, 5 Oct 2019 12:43:46 +0200 Subject: [PATCH] less magic trick in fpga_compress for coverity --- tools/fpga_compress/fpga_compress.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/fpga_compress/fpga_compress.c b/tools/fpga_compress/fpga_compress.c index 54d2438d2..2174571d6 100644 --- a/tools/fpga_compress/fpga_compress.c +++ b/tools/fpga_compress/fpga_compress.c @@ -275,11 +275,15 @@ static int bitparse_find_section(FILE *infile, char section_name, unsigned int * /* Four byte length field */ current_length += fgetc(infile) << 24; current_length += fgetc(infile) << 16; - numbytes += 2; + current_length += fgetc(infile) << 8; + current_length += fgetc(infile) << 0; + numbytes += 4; + break; default: /* Fall through, two byte length field */ current_length += fgetc(infile) << 8; current_length += fgetc(infile) << 0; numbytes += 2; + break; } if (current_name != 'e' && current_length > 255) {