Fwd: New Defects reported by Coverity Scan for LyX
Jean-Marc Lasgouttes
lasgouttes at lyx.org
Wed Jul 8 12:53:49 UTC 2020
Hello,
More work for Thibaut :) I ran coverity against master and here is what
it returns (below).
Item 1 is about checking return of regex_match
Item 2 is probably fixed by an earlier definition of the "label" variable
Item 3&4 seem to be only an issue with libstdc++, we cannot do much
about it IMO.
The full dashboard is at
https://scan.coverity.com/projects/lyx?tab=overview
JMarc
-------- Message transféré --------
Sujet : New Defects reported by Coverity Scan for LyX
Date : Wed, 08 Jul 2020 10:32:16 +0000 (UTC)
De : scan-admin at coverity.com
Pour : lasgouttes at lyx.org
Hi,
Please find the latest report on new defect(s) introduced to LyX found
with Coverity Scan.
4 new defect(s) introduced to LyX found with Coverity Scan.
New defect(s) Reported-by: Coverity Scan
Showing 4 of 4 defect(s)
** CID 360530: Error handling issues (CHECKED_RETURN)
/home/lasgoutt/src/lyx/coverity/lyx/src/insets/InsetBibtex.cpp: 1194 in
lyx::InsetBibtex::docbook(lyx::XMLStream &, const lyx::OutputParams &)
const()
________________________________________________________________________________________________________
*** CID 360530: Error handling issues (CHECKED_RETURN)
/home/lasgoutt/src/lyx/coverity/lyx/src/insets/InsetBibtex.cpp: 1194 in
lyx::InsetBibtex::docbook(lyx::XMLStream &, const lyx::OutputParams &)
const()
1188 map<string, string> delayedTags;
1189 1190 // Read all tags from HTML and convert those that
have a 1:1 matching.
1191 while (tagIt != tagEnd) {
1192 string tag = tagIt->str(); // regex_match cannot work with
temporary strings.
1193 ++tagIt;
>>> CID 360530: Error handling issues (CHECKED_RETURN)
>>> Calling "regex_match" without checking return value (as is done elsewhere 48 out of 49 times).
1194 std::regex_match(tag, match, tagRegex);
1195 1196 if (toDocBookTag.find(match[1]) ==
toDocBookTag.end()) {
1197 LYXERR0("The BibTeX field " << match[1].str() << " is
unknown.");
1198 xs << XMLStream::ESCAPE_NONE << from_utf8("<!-- Output
Error: The BibTeX field " + match[1].str() + " is unknown -->\n");
1199 continue;
** CID 360529: Null pointer dereferences (FORWARD_NULL)
/home/lasgoutt/src/lyx/coverity/lyx/src/output_docbook.cpp: 926 in
lyx::docbookParagraphs(const lyx::Text &, const lyx::Buffer &,
lyx::XMLStream &, const lyx::OutputParams &)()
________________________________________________________________________________________________________
*** CID 360529: Null pointer dereferences (FORWARD_NULL)
/home/lasgoutt/src/lyx/coverity/lyx/src/output_docbook.cpp: 926 in
lyx::docbookParagraphs(const lyx::Text &, const lyx::Buffer &,
lyx::XMLStream &, const lyx::OutputParams &)()
920 docstring id = docstring();
921 for (pos_type i = 0; i < par->size(); ++i) {
922 Inset const *inset = par->getInset(i);
923 if (inset && dynamic_cast<InsetLabel const *>(inset)) {
924 // Generate the attributes for the section if need be.
925 auto label = dynamic_cast<InsetLabel const *>(inset);
>>> CID 360529: Null pointer dereferences (FORWARD_NULL)
>>> Passing null pointer "label" to "_ZNK3lyx10InsetLabel11screenLabelB5cxx11Ev", which dereferences it. (The dereference happens because this is a virtual function call.)
926 id += "xml:id=\"" + xml::cleanID(label->screenLabel()) + "\"";
927 928 // Don't output the ID as a DocBook <anchor>.
929
ourparams.docbook_anchors_to_ignore.emplace(label->screenLabel());
930 931 // Cannot have multiple IDs per tag.
** CID 349481: Resource leaks (CTOR_DTOR_LEAK)
________________________________________________________________________________________________________
*** CID 349481: Resource leaks (CTOR_DTOR_LEAK)
/usr/include/c++/9/bits/hashtable.h: 1241 in
std::_Hashtable<std::__cxx11::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t>>,
std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>,
std::allocator<wchar_t>>,
std::allocator<std::__cxx11::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t>>>,
std::__detail::_Identity,
std::equal_to<std::__cxx11::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t>>>,
std::hash<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>,
std::allocator<wchar_t>>>, std::__detail::_Mod_range_hashing,
std::__detail::_Default_ranged_hash,
std::__detail::_Prime_rehash_policy,
std::__detail::_Hashtable_traits<(bool)1, (bool)1,
(bool)1>>::_Hashtable(const
std::_Hashtable<std::__cxx11::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t>>,
std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>,
std::allocator<wchar_t>>,
std::allocator<std::__cxx11::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t>>>,
std::__detail::_Identity,
std::equal_to<std::__cxx11::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t>>>,
std::hash<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>,
std::allocator<wchar_t>>>, std::__detail::_Mod_range_hashing,
std::__detail::_Default_ranged_hash,
std::__detail::_Prime_rehash_policy,
std::__detail::_Hashtable_traits<(bool)1, (bool)1, (bool)1>>&)()
1235 __node_alloc_traits::_S_select_on_copy(__ht._M_node_allocator())),
1236 _M_buckets(nullptr),
1237 _M_bucket_count(__ht._M_bucket_count),
1238 _M_element_count(__ht._M_element_count),
1239 _M_rehash_policy(__ht._M_rehash_policy)
1240 {
>>> CID 349481: Resource leaks (CTOR_DTOR_LEAK)
>>> Calling allocation function "_M_assign".
1241 _M_assign(__ht,
1242 [this](const __node_type* __n)
1243 { return this->_M_allocate_node(__n->_M_v()); });
1244 }
1245 1246 template<typename _Key, typename _Value,
** CID 345222: Resource leaks (RESOURCE_LEAK)
/usr/include/c++/9/bits/hashtable.h: 1656 in
std::_Hashtable<std::__cxx11::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t>>,
std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>,
std::allocator<wchar_t>>,
std::allocator<std::__cxx11::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t>>>,
std::__detail::_Identity,
std::equal_to<std::__cxx11::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t>>>,
std::hash<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>,
std::allocator<wchar_t>>>, std::__detail::_Mod_range_hashing,
std::__detail::_Default_ranged_hash,
std::__detail::_Prime_rehash_policy,
std::__detail::_Hashtable_traits<(bool)1, (bool)1,
(bool)1>>::_M_emplace<std::__cxx11::basic_string<wchar_t,
std::char_traits<wchar_t>,
std::allocator<wchar_t>>>(std::integral_constant<bool, (bool)1>, T1 &&...)()
________________________________________________________________________________________________________
*** CID 345222: Resource leaks (RESOURCE_LEAK)
/usr/include/c++/9/bits/hashtable.h: 1656 in
std::_Hashtable<std::__cxx11::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t>>,
std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>,
std::allocator<wchar_t>>,
std::allocator<std::__cxx11::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t>>>,
std::__detail::_Identity,
std::equal_to<std::__cxx11::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t>>>,
std::hash<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>,
std::allocator<wchar_t>>>, std::__detail::_Mod_range_hashing,
std::__detail::_Default_ranged_hash,
std::__detail::_Prime_rehash_policy,
std::__detail::_Hashtable_traits<(bool)1, (bool)1,
(bool)1>>::_M_emplace<std::__cxx11::basic_string<wchar_t,
std::char_traits<wchar_t>,
std::allocator<wchar_t>>>(std::integral_constant<bool, (bool)1>, T1 &&...)()
1650 1651 size_type __bkt = _M_bucket_index(__k, __code);
1652 if (__node_type* __p = _M_find_node(__bkt, __k, __code))
1653 {
1654 // There is already an equivalent node, no insertion
1655 this->_M_deallocate_node(__node);
>>> CID 345222: Resource leaks (RESOURCE_LEAK)
>>> Variable "__node" going out of scope leaks the storage it points to.
1656 return std::make_pair(iterator(__p), false);
1657 }
1658 1659 // Insert the node
1660 return std::make_pair(_M_insert_unique_node(__bkt, __code,
__node),
1661 true);
________________________________________________________________________________________________________
To view the defects in Coverity Scan visit,
https://u2389337.ct.sendgrid.net/ls/click?upn=nJaKvJSIH-2FPAfmty-2BK5tYpPklAc1eEA-2F1zfUjH6teExErcYPny-2FefN2p2-2Fds-2B-2FKzCo1SfdaW-2BQ0IUwUNXpHMyw-3D-3DqDLM_oAivpe0BqaIojkLjliX-2BG3gO8g8YhoOqDVHj4gbeQ0l-2FMvM-2FVNs8bjcyd6ZmmLO0ThihxY0qHvtasUDLayVw4Z0laZb0DW70nZnP8rxSHv0FYRXt0XG691boNmVkhA-2Bg2Il4f5xuHWVFj6NFA3lNEvEpz4ODPW3R2mQKu-2Bm-2FimmKiXZWkfbDfErT0Ia4aT2OqFnTYiYHkwVp26PAHMtPu-2B-2FNE4KiIlJJcuOYtqCFpMg-3D
To manage Coverity Scan email notifications for "lasgouttes at lyx.org",
click
https://u2389337.ct.sendgrid.net/ls/click?upn=nJaKvJSIH-2FPAfmty-2BK5tYpPklAc1eEA-2F1zfUjH6teEwKPNNrzEFiIgTetQBd7l2XY7du8dR94-2FWqHUBI-2BRSOvlBZmvjeqNLOof89M2Q7iZ9lB46kFOzXItQWPyKYZJgS0m8OQrTzkC-2Fwpo0PoC6ozdurBHLMZV7lMN-2BVO2tJ4OM-3DlgCI_oAivpe0BqaIojkLjliX-2BG3gO8g8YhoOqDVHj4gbeQ0l-2FMvM-2FVNs8bjcyd6ZmmLO0iBbicfhV8-2FNaTmp8VFPaM9zaDYTQl-2FcQRmey1Ga6rAIjmshLtY0417E1aRXibntL6djY7DbYL3hx2qaTNkgFE-2BxVj8WVd1VlHxxTmAM20JBDiGwm57d-2B5YUfzJZXsbion-2Bm97FToUjGDiBFwfCHLj8f3lvVg-2BZlBcOKnkXtjluI-3D
More information about the lyx-devel
mailing list