[Bug other/80049] New: gcc/genmodes.c: PVS-Studio: NULL Pointer Dereference (CWE-476)
khandeliants at viva64 dot com
gcc-bugzilla@gcc.gnu.org
Wed Mar 15 14:53:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80049
Bug ID: 80049
Summary: gcc/genmodes.c: PVS-Studio: NULL Pointer Dereference
(CWE-476)
Product: gcc
Version: 7.0.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: other
Assignee: unassigned at gcc dot gnu.org
Reporter: khandeliants at viva64 dot com
Target Milestone: ---
We have found a weakness (CWE-476) using PVS-Studio tool. PVS-Studio is a
static code analyzer for C, C++ and C#: https://www.viva64.com/en/pvs-studio/
Analyzer warning: V595 The 'm->component' pointer was utilized before it was
verified against nullptr. Check lines: 399, 407. genmodes.c 399
static void complete_mode (struct mode_data *m)
{
....
if ( m->cl == MODE_COMPLEX_INT
|| m->cl == MODE_COMPLEX_FLOAT)
alignment = m->component->bytesize; // <=
else
alignment = m->bytesize;
m->alignment = alignment & (~alignment + 1);
if (m->component) // <=
{
m->next_cont = m->component->contained;
m->component->contained = m;
}
}
More information about the Gcc-bugs
mailing list