Skip to content

Commit

Permalink
Type casting inconsistency #174
Browse files Browse the repository at this point in the history
Avoid overflows by casting to the larger type, zero-extended
  • Loading branch information
rurban committed Dec 26, 2019
1 parent b5819bf commit 631bbac
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ check-dxf: all
done; \
done

# clang-analyzer.llvm.org, debian: clang-tools-{6.0,7}
# clang-analyzer.llvm.org, debian: clang-tools-{6.0,7}, redhat: clang-analyzer
SCAN_BUILD = scan-build
scan-build: clean
$(SCAN_BUILD) -V -o .analysis $(MAKE) -j4 &
Expand Down
2 changes: 1 addition & 1 deletion src/decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -2572,7 +2572,7 @@ read_2004_section_handles (Bit_Chain *restrict dat, Dwg_Data *restrict dwg)
}

last_offset = 0;
while ((int)(hdl_dat.byte - startpos) < section_size)
while ((long)(hdl_dat.byte - startpos) < (long)section_size)
{
int added;
BITCODE_UMC handleoff;
Expand Down
2 changes: 1 addition & 1 deletion src/decode_r2007.c
Original file line number Diff line number Diff line change
Expand Up @@ -1591,7 +1591,7 @@ read_2007_section_handles (Bit_Chain *dat, Bit_Chain *hdl,
}

last_offset = 0;
while (hdl_dat.byte - startpos < section_size)
while ((long)(hdl_dat.byte - startpos) < (long)section_size)
{
int added;
BITCODE_UMC handleoff;
Expand Down

0 comments on commit 631bbac

Please # to comment.