Please note that extent of float type is much more higher than 0xFFFFFFFFFFFFFFFF. Your false positive is a complete nonsense. The condition is apparently not always true.
CWE: 571 Condition 'ff>0xFFFFFFFFFFFFFFFF' is always true
/** Write float valur to datapool variant. The variant type is resolved internally. */ void DatapoolVariant::SetAsFloat(float ff) { if(size>1) { if(pVoid==NULL) return; switch(type) { case 'Q': if(ff<0) {*ArrQ=0;break;} if(ff>0xFFFFFFFFFFFFFFFF) {*ArrQ=0xFFFFFFFFFFFFFFFF;break;} *ArrQ = (UINT64)ff; break; case 'q': *Arrq = (INT64)ff; break;
I can reproduce with this snippet:
void SetAsFloat(float ff, char type) { switch(type) { case 'Q': if(ff<0) {*ArrQ=0;break;} if(ff>0xFFFFFFFFFFFFFFFF) {*ArrQ=0xFFFFFFFFFFFFFFFF;break;} break; } }
This seems to be an instance of this problem: https://trac.cppcheck.net/ticket/10150
Log in to post a comment.
Please note that extent of float type is much more higher than 0xFFFFFFFFFFFFFFFF.
Your false positive is a complete nonsense. The condition is apparently not always true.
CWE: 571
Condition 'ff>0xFFFFFFFFFFFFFFFF' is always true
I can reproduce with this snippet:
This seems to be an instance of this problem: https://trac.cppcheck.net/ticket/10150