jpeg-compressor icon indicating copy to clipboard operation
jpeg-compressor copied to clipboard

Coverity issue(s)

Open jackun opened this issue 4 years ago • 2 comments

  1. Statement is always false:

https://github.com/richgel999/jpeg-compressor/blob/aeb7d3b463aa8228b87a28013c15ee50a7e6fcf3/jpgd.cpp#L779

And just in case this is not a false positive: 2) Overrunning array jpgd::g_ZAG of 64 4-byte elements at element index 64 (byte offset 259) using index kt++ (which evaluates to 64).

https://github.com/richgel999/jpeg-compressor/blob/aeb7d3b463aa8228b87a28013c15ee50a7e6fcf3/jpgd.cpp#L1533

jackun avatar Oct 06 '20 08:10 jackun

Thank you, I'll add a logical and against 63 here to silence Coverity. I've seen the 2nd issue before, this statement should prevent the problem but I'll add the logical and in the loop to be sure:

if ((k + r) > 63) stop_decoding(JPGD_DECODE_ERROR);

richgel999 avatar Oct 06 '20 18:10 richgel999

Then I think the 2nd issue has been fixed already https://github.com/richgel999/jpeg-compressor/blob/aeb7d3b463aa8228b87a28013c15ee50a7e6fcf3/jpgd.cpp#L1525-L1526

jackun avatar Oct 06 '20 18:10 jackun