[BUG] profile.c / plot_cylinder_pressure_text()
Dirk Hohndel
dirk at hohndel.org
Sun Nov 11 07:10:22 PST 2012
"Lubomir I. Ivanov" <neolit123 at gmail.com> writes:
> against 96fb31bc0128414
> there is a bug a cannot reproduce on ubuntu/debian, but gdb on win7 shows a:
> --------
> Program received signal SIGSEGV, Segmentation fault.
> 0x00423ae1 in plot_cylinder_pressure_text (gc=0x470380, pi=0x3512f78)
> at profile.c:1303
> 1303 cyl = entry->cylinderindex;
> --------
> when subsurface opens 'test12.xml".
>
> bug is not present if there are not <cylinder..> entries in the XML.
> a naive solution seems to be to check if "entry" is NULL.
This puzzles me.
for (i = 1; i < pi->nr; i++) {
entry = pi->entry + i;
if (!entry->same_cylinder) {
cyl = entry->cylinderindex;
if (!seen_cyl[cyl]) {
mbar = GET_PRESSURE(entry);
plot_pressure_value(gc, mbar, entry->sec, LEFT, BOTTOM);
seen_cyl[cyl] = TRUE;
}
if (i > 2) {
/* remember the last pressure and time of
* the previous cylinder */
cyl = (entry - 1)->cylinderindex;
last_pressure[cyl] = GET_PRESSURE(entry - 1);
last_time[cyl] = (entry - 1)->sec;
}
}
}
cyl = entry->cylinderindex;
How can entry be NULL? Unless we have an invalid plot_info structure.
So instead of just checking for NULL I would love to figure out how the
could be NULL - because THAT seems to be the bug to me...
/D
More information about the subsurface
mailing list