Skip to content

Commit

Permalink
fix warnings reported by CodeQL (#96)
Browse files Browse the repository at this point in the history
* fix code-issues reported by CodeQL
* add to changelog
  • Loading branch information
ptahmose committed Mar 25, 2024
1 parent b0898cb commit 9a7503b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.15)
cmake_policy(SET CMP0091 NEW) # enable new "MSVC runtime library selection" (https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html)

project(libCZI
VERSION 0.58.1
VERSION 0.58.2
HOMEPAGE_URL "https://github.com/ZEISS/libczi"
DESCRIPTION "libCZI is an Open Source Cross-Platform C++ library to read and write CZI")

Expand Down
4 changes: 2 additions & 2 deletions Src/JxrDecode/jxrlib/image/encode/strenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Int writeTileHeaderLP(CWMImageStrCodec* pSC, BitIOInfo* pIO)
for (i = 0; i < pTile->cNumQPLP; i++) {
pTile->cChModeLP[i] = (U8)(rand() & 3); // channel mode, just for concept proofing!

for (j = 0; j < pSC->m_param.cNumChannels; j++)
for (j = 0; j < (U8)pSC->m_param.cNumChannels; j++)
pTile->pQuantizerLP[j][i].iIndex = (U8)((rand() & 0xfe) + 1); // QP indexes, just for concept proofing!
formatQuantizer(pTile->pQuantizerLP, pTile->cChModeLP[i], pSC->m_param.cNumChannels, i, TRUE, pSC->m_param.bScaledArith);
writeQuantizer(pTile->pQuantizerLP, pIO, pTile->cChModeLP[i], pSC->m_param.cNumChannels, i);
Expand Down Expand Up @@ -189,7 +189,7 @@ Int writeTileHeaderHP(CWMImageStrCodec* pSC, BitIOInfo* pIO)
for (i = 0; i < pTile->cNumQPHP; i++) {
pTile->cChModeHP[i] = (U8)(rand() & 3); // channel mode, just for concept proofing!

for (j = 0; j < pSC->m_param.cNumChannels; j++)
for (j = 0; j < (U8)pSC->m_param.cNumChannels; j++)
pTile->pQuantizerHP[j][i].iIndex = (U8)((rand() & 0xfe) + 1); // QP indexes, just for concept proofing!
formatQuantizer(pTile->pQuantizerHP, pTile->cChModeHP[i], pSC->m_param.cNumChannels, i, FALSE, pSC->m_param.bScaledArith);
writeQuantizer(pTile->pQuantizerHP, pIO, pTile->cChModeHP[i], pSC->m_param.cNumChannels, i);
Expand Down
4 changes: 2 additions & 2 deletions Src/JxrDecode/jxrlib/jxrgluelib/JXRGlue.c
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ ERR PKImageEncode_WriteSource(
cbStride = cbStrideFrom > cbStrideTo ? cbStrideFrom : cbStrideTo;// max(cbStrideFrom, cbStrideTo);

// actual dec/enc with local buffer
Call(PKAllocAligned((void**)&pb, cbStride * pRect->Height, 128));
Call(PKAllocAligned((void**)&pb, (size_t)cbStride * pRect->Height, 128));

Call(pFC->Copy(pFC, pRect, pb, cbStride));

Expand Down Expand Up @@ -779,7 +779,7 @@ ERR PKImageEncode_Transcode(
else
{
// actual dec/enc with local buffer
Call(PKAllocAligned((void**)&pb, cbStride * pRect->Height, 128));
Call(PKAllocAligned((void**)&pb, (size_t)cbStride * pRect->Height, 128));
Call(pFC->Copy(pFC, pRect, pb, cbStride));
Call(pIE->WritePixels(pIE, pRect->Height, pb, cbStride));
}
Expand Down
4 changes: 2 additions & 2 deletions Src/JxrDecode/jxrlib/jxrgluelib/JXRGlueJxr.c
Original file line number Diff line number Diff line change
Expand Up @@ -2050,7 +2050,7 @@ ERR PKImageDecode_Copy_WMP(
wmiBI.pv = pbLowMemAdj;

// If we're past the top of the image, then we're done, so terminate.
if (linesperMBRow * (cMBRow - 1) >= (U32)pID->WMP.cLinesCropped + pID->WMP.wmiI.cROIHeight) {
if (linesperMBRow * (size_t)(cMBRow - 1) >= pID->WMP.cLinesCropped + pID->WMP.wmiI.cROIHeight) {
FailIf(ICERR_OK != ImageStrDecTerm(pID->WMP.ctxSC), WMP_errFail);
}
pID->WMP.DecoderCurrMBRow = cMBRow; // Set to next possible MBRow that is decodable
Expand Down Expand Up @@ -2132,7 +2132,7 @@ ERR PKImageDecode_Copy_WMP(
}

// If we're past the top of the image, then we're done, so terminate
if (linesperMBRow * (cMBRow - 1) >= (U32)pID->WMP.cLinesCropped + pID->WMP.wmiI.cROIHeight) {
if (linesperMBRow * (size_t)(cMBRow - 1) >= pID->WMP.cLinesCropped + pID->WMP.wmiI.cROIHeight) {
FailIf(ICERR_OK != ImageStrDecTerm(pID->WMP.ctxSC_Alpha), WMP_errFail);
}
pID->WMP.DecoderCurrAlphaMBRow = cMBRow; // Set to next possible MBRow that is decodable
Expand Down
3 changes: 2 additions & 1 deletion Src/libCZI/Doc/version-history.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ version history {#version_history}
0.57.2 | [90](https://github.com/ZEISS/libczi/pull/90) | improve thread-safety of CziReader
0.57.3 | [91](https://github.com/ZEISS/libczi/pull/91) | improve error-message
0.58.0 | [92](https://github.com/ZEISS/libczi/pull/92) | export a list with properties for streams-property-bag
0.58.1 | [95](https://github.com/ZEISS/libczi/pull/95) | some fixes for CziReaderWriter
0.58.1 | [95](https://github.com/ZEISS/libczi/pull/95) | some fixes for CziReaderWriter
0.58.2 | [95](https://github.com/ZEISS/libczi/pull/96) | small fixes for deficiencies reported by CodeQL

0 comments on commit 9a7503b

Please sign in to comment.