After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 788757 - covscan warnings
covscan warnings
Status: RESOLVED FIXED
Product: grilo
Classification: Other
Component: lua
unspecified
Other Linux
: Normal normal
: ---
Assigned To: grilo-maint
grilo-maint
Depends on:
Blocks:
 
 
Reported: 2017-10-10 08:34 UTC by Bastien Nocera
Modified: 2017-10-16 11:25 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
lua-factory: Replace assertions with g_return_* macros (4.96 KB, patch)
2017-10-10 09:14 UTC, Bastien Nocera
committed Details | Review
lua-factory: Remove unused variable in XML parser (1.38 KB, patch)
2017-10-10 09:14 UTC, Bastien Nocera
committed Details | Review

Description Bastien Nocera 2017-10-10 08:34:54 UTC
grilo-plugins-0.3.4/src/lua-factory/lua-library/lua-xml.c:88: assigned_pointer: Assigning value from "is_root_node ? node : node->children" to "node" here, but that stored value is overwritten before it can be used.


grilo-plugins-0.3.4/src/lua-factory/grl-lua-library-operations.c:899:33: warning: Access to field 'source' results in a dereference of a null pointer (loaded from variable 'os')

grilo-plugins-0.3.4/src/lua-factory/grl-lua-library-operations.c:853:33: warning: Access to field 'source' results in a dereference of a null pointer (loaded from variable 'os')

grilo-plugins-0.3.4/src/lua-factory/grl-lua-library-operations.c:850:3: warning: Dereference of null pointer (loaded from variable 'err')
Comment 1 Bastien Nocera 2017-10-10 09:14:47 UTC
Created attachment 361219 [details] [review]
lua-factory: Replace assertions with g_return_* macros

Assertions might be disabled, and really shouldn't be used from within a
library, but this should protect us enough for debugging purposes.
Comment 2 Bastien Nocera 2017-10-10 09:14:53 UTC
Created attachment 361220 [details] [review]
lua-factory: Remove unused variable in XML parser

The variable assignment wasn't used, and "node" was already assigned to
either the root node, or one of its children earlier in the function.

Caught by covscan:
grilo-plugins-0.3.4/src/lua-factory/lua-library/lua-xml.c:88: assigned_pointer: Assigning value from "is_root_node ? node : node->children" to "node" here, but that stored value is overwritten before it can be used.
Comment 3 Victor Toso 2017-10-16 08:32:43 UTC
Review of attachment 361219 [details] [review]:

These asserts are calls inside the library and shouldn't be triggered by applications, normally.

As you said, we can disable the assert. Moving to warning and set fatal-warnings in G_DEBUG should still be doable if necessary.
Comment 4 Victor Toso 2017-10-16 08:35:16 UTC
Review of attachment 361220 [details] [review]:

Sure
Comment 5 Victor Toso 2017-10-16 08:35:17 UTC
Review of attachment 361220 [details] [review]:

Sure
Comment 6 Bastien Nocera 2017-10-16 11:25:32 UTC
Attachment 361219 [details] pushed as a7eb4b9 - lua-factory: Replace assertions with g_return_* macros
Attachment 361220 [details] pushed as 8c5969e - lua-factory: Remove unused variable in XML parser