Fix coverity issues

This commit is contained in:
heckflosse 2018-11-20 14:42:39 +01:00
parent 61d8a4f254
commit 1cdd814e1b
3 changed files with 9 additions and 6 deletions

View File

@ -760,12 +760,13 @@ void XMLCALL rtengine::LCPProfile::XmlStartHandler(void* pLCPProfile, const char
++src;
}
strcpy(pProf->lastTag, src);
strncpy(pProf->lastTag, src, sizeof(pProf->lastTag) - 1);
pProf->lastTag[sizeof(pProf->lastTag) - 1] = 0;
const std::string src_str = src;
if (src_str == "VignetteModelPiecewiseParam") {
strcpy(pProf->inInvalidTag, src);
strncpy(pProf->inInvalidTag, src, sizeof(pProf->inInvalidTag) - 1);
pProf->inInvalidTag[sizeof(pProf->inInvalidTag) - 1] = 0;
}
if (src_str == "CameraProfiles") {

View File

@ -131,8 +131,8 @@ private:
bool inPerspect;
bool inAlternateLensID;
bool inAlternateLensNames;
char lastTag[256];
char inInvalidTag[256];
char lastTag[257];
char inInvalidTag[257];
LCPPersModel* pCurPersModel;
LCPModelCommon* pCurCommon;

View File

@ -89,7 +89,7 @@ static int parseHuff(ljp* self) {
u8* huffhead = &self->data[self->ix]; // xstruct.unpack('>HB16B',self.data[self.ix:self.ix+19])
u8* bits = &huffhead[2];
bits[0] = 0; // Because table starts from 1
int hufflen = BEH(huffhead[0]);
unsigned int hufflen = BEH(huffhead[0]);
if ((self->ix + hufflen) >= self->datalen) return ret;
#ifdef SLOW_HUFF
u8* huffval = calloc(hufflen - 19,sizeof(u8));
@ -546,8 +546,10 @@ static int parseScan(ljp* self) {
Px = left + lastrow[col] - lastrow[col-1];break;
case 5:
Px = left + ((lastrow[col] - lastrow[col-1])>>1);break;
/* case 6 has a shortcut above
case 6:
Px = lastrow[col] + ((left - lastrow[col-1])>>1);break;
*/
case 7:
Px = (left + lastrow[col])>>1;break;
}