About coverity 440107 (keyimpl.cxx in registry)

julien2412 serval2412 at yahoo.fr
Fri Mar 22 14:12:29 PDT 2013


Hello,

Scan coverity reported this:
dead_error_begin: Execution cannot reach this statement "case 5:"
dead_error_begin: Execution cannot reach this statement "case 6:"
dead_error_begin: Execution cannot reach this statement "case 7:"

See
http://opengrok.libreoffice.org/xref/core/registry/source/keyimpl.cxx#604

Indeed we have this switch:
    622     switch (valueType)
    623     {
    624         case RG_VALUETYPE_NOT_DEFINED:
    625             memcpy(value, pBuffer, valueSize);
    626             break;
    627         case RG_VALUETYPE_LONG:
    628             readINT32(pBuffer, *((sal_Int32*)value));
    629             break;
    630         case RG_VALUETYPE_STRING:
    631             readUtf8(pBuffer, (sal_Char*)value, valueSize);
    632             break;
    633         case RG_VALUETYPE_UNICODE:
    634             readString(pBuffer, (sal_Unicode*)value, valueSize);
    635             break;
    636         case RG_VALUETYPE_BINARY:
    637             memcpy(value, pBuffer, valueSize);
    638             break;
    639         case RG_VALUETYPE_LONGLIST:
    640         case RG_VALUETYPE_STRINGLIST:
    641         case RG_VALUETYPE_UNICODELIST:
    642             memcpy(value, pBuffer, valueSize);
    643             break;
    644     }

but some lines above:
    604     if (valueType > 4)
    605     {
    606         return REG_INVALID_VALUE;
    607     }

I took a look, it's like this since initial import in 2000.
Should if (valueType > 4) be removed or should we clean the >4 cases ?

Julien



--
View this message in context: http://nabble.documentfoundation.org/About-coverity-440107-keyimpl-cxx-in-registry-tp4045470.html
Sent from the Dev mailing list archive at Nabble.com.


More information about the LibreOffice mailing list