﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
5556	Undefined behavior in OpenModelicaScriptingAPIQt.cpp	Anatoly Trosinenko	Adrian Pop	"According to [https://test.openmodelica.org/scan-build/latest/2019-06-28-122907-428-1/ Clang Static Analyzer reports], the `OpenModelicaScriptingAPIQt.cpp` file contains lots of exception handling triggering Undefined Behavior such as [https://test.openmodelica.org/scan-build/latest/2019-06-28-122907-428-1/report-57a8da.html#EndPath this one].

On the first glance, it looks like harmless rethrowing, but OMEdit [https://github.com/OpenModelica/OpenModelica/blob/4dc44f91c3bb6d10b5571cbf1217b922479ff0d3/OMEdit/OMEdit/OMEditGUI/OMC/OMCProxy.cpp#L249 contains the code] that handles this `throwException` signal with `showException` slot. This suggests that it is not a noreturn function, so the execution flows to the line

{{{#!cpp
responseLog.append(result ? ""true"" : ""false"");
}}}

This, again, looks harmless (just slightly misleading random `true` or `false` in log), but precisely this pattern was observed as [https://stackoverflow.com/questions/54120862/does-the-c-standard-allow-for-an-uninitialized-bool-to-crash-a-program crasing the program] instead of just showing garbage: the compiler spotted, that 
{{{#!cpp
strlen(flag ? ""true"" : ""false"") == 1 - flag
}}}

I have tried to rewrite this file but have not succeeded: looks like one bootstrapping iteration was not enough in my case... Though, there are examples of commits successfully changing this template. This shows some non-triviality of contributing to this file."	defect	new	high	Future	Susan (Templates)	v1.14.0-dev-nightly			
