On Sun, 8 Jan 2023 at 22:46, Jean-Marc Lasgouttes <lasgout...@lyx.org> wrote:
> Le 08/01/2023 à 22:39, Richard Kimberly Heck a écrit : > > On 1/8/23 15:21, Thibaut Cuvelier wrote: > >> commit 2d56c01dcfaf04744ab6d854af3965919cc07b82 > >> Author: Thibaut Cuvelier <tcuvel...@lyx.org> > >> Date: Sun Jan 8 22:19:39 2023 +0100 > >> > >> InsetIndex: make a condition more bullet-proof, a nullptr could > >> be dereferenced. > >> Error noticed by Coverity: > >> *** CID 382777: Memory - illegal accesses (RETURN_LOCAL) > >> /home/lasgoutt/src/lyx/coverity/lyx/src/insets/InsetIndex.cpp: > >> 1866 in > >> > _ZNK3lyx15InsetPrintIndex5xhtmlB5cxx11ERNS_9XMLStreamERKNS_12OutputParamsE() > >> 1860 > >> 1861 // Collect the index entries in a form we can use > >> them. > >> 1862 vector<IndexEntry> entries; > >> 1863 const docstring & indexType = > >> params().getParamOr("type", from_ascii("idx")); > >> 1864 for (const TocItem& item : *toc) { > >> 1865 const auto* inset = static_cast<const > >> InsetIndex*>(&(item.dit().inset())); > >> >>> CID 382777: Memory - illegal accesses (RETURN_LOCAL) > >> >>> Using "indexType", which points to an out-of-scope > >> temporary variable of type "lyx::docstring const". > > > > Isn't the warning rather that getParamOr could return a reference to > > 'from_ascii("idx")', which coverity is saying is now out of scope? Is > > that OK? Maybe it wants us to declare that separately? > > > That's my reading too. > Thanks for your readings :)! I changed the code to have a separate declaration of the default value.
-- lyx-devel mailing list lyx-devel@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-devel