Bug 1588482 - For Coverity analysis add a modeling file when dealing with json_cpp. r=sylvestre

Differential Revision: https://phabricator.services.mozilla.com/D49133

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andi-Bogdan Postelnicu 2019-10-14 13:15:46 +00:00
Родитель b3de1edab5
Коммит bdf27fe3bd
1 изменённых файлов: 20 добавлений и 0 удалений

Просмотреть файл

@ -114,3 +114,23 @@ class ByteReader {
return ptr[0] << 16 | ptr[1] << 8 | ptr[2]; return ptr[0] << 16 | ptr[1] << 8 | ptr[2];
} }
}; };
// In Bug 1248897 we've seen that Coverity thinks that json-cpp allocates
// memmory for the strings that are used as indexes, this is wrong and this
// model of CZString fixes this.
namespace Json {
class Value {
private:
class CZString {
private:
char const* cstr_;
public:
~CZString() {
// Don't do anything since most of the time cstr_ only stores address of
// str
__coverity_escape__(static_cast<void*>(cstr_));
}
};
};
} // namespace Json