Potential NULL dereference in void VIO_update_in_place

11 views
Skip to first unread message

Mark Rotteveel

unread,
Jul 8, 2025, 4:30:08 AMJul 8
to firebir...@googlegroups.com
Prompted by a Visual Studio analysis warning in vio.cpp, looking at
void VIO_update_in_place
it seems to me that

```
DPM_store(tdbb, &temp2, *stack, DPM_secondary);

if (stack)
{
const USHORT pageSpaceID = temp2.getWindow(tdbb).win_page.getPageSpaceID();
stack->push(PageNumber(pageSpaceID, temp2.rpb_page));
}
```

as stack can be NULL at that point, it should be:

```
if (stack)
{
DPM_store(tdbb, &temp2, *stack, DPM_secondary);
const USHORT pageSpaceID = temp2.getWindow(tdbb).win_page.getPageSpaceID();
stack->push(PageNumber(pageSpaceID, temp2.rpb_page));
}
```

Is that correct?

Mark
--
Mark Rotteveel

Dimitry Sibiryakov

unread,
Jul 8, 2025, 4:55:51 AMJul 8
to firebir...@googlegroups.com
'Mark Rotteveel' via firebird-devel wrote 08.07.2025 10:30:
> Is that correct?

No. It was my fault.

`if (stack)` is not needed here because it is not possible update
non-existing record so `stack` is unavoidable assigned to some value, but `else
fb_assert(false)` during the assignment wouldn't hurt.

--
WBR, SD.

Mark Rotteveel

unread,
Jul 8, 2025, 5:43:51 AMJul 8
to firebir...@googlegroups.com
I asserted stack itself after the assignment logic, see
https://github.com/FirebirdSQL/firebird/commit/e4b433af21ba0bcfef6d3692c510219f2b409ddb

Mark
--
Mark Rotteveel
Reply all
Reply to author
Forward
0 new messages