Repository navigation
Conversation
| // mark the index as utilized for the purposes of this compile | ||
| idx->idx_runtime_flags |= idx_used; | ||
|
|
||
| const ULONG impure = csb ? csb->allocImpure<impure_inversion>() : 0; |
There was a problem hiding this comment.
If you think that this comparison is redundant, you must make it sure by replacing of a pointer with a reference through whole call stack. The same with m_creation.
There was a problem hiding this comment.
Just look at the beginning of the function; it contains fb_assert(csb), and csb->csb_g_flags is accessed without any check.
As for m_creation, it is used only in one place:
IndexCreateTask task(tdbb, dbb->dbb_permanent, &creation);There was a problem hiding this comment.
fb_assert is a soft trap, hot hard guarantee. The problem is that Firebird QA use a release build where fb_assert is no-op. As an overall result you just add another place for null pointer dereference and crash.
There was a problem hiding this comment.
and csb->csb_g_flags is accessed without any check.
There was a problem hiding this comment.
It is something to fix, not excuse.
There was a problem hiding this comment.
fb_assertis a soft trap, hot hard guarantee. The problem is that Firebird QA use a release build wherefb_assertis no-op. As an overall result you just add another place for null pointer dereference and crash.
Ussaly, a fb_assert(csb) call implies that it is the programmer’s responsibility to ensure that csb exists at the time this function is called.
There was a problem hiding this comment.
Exactly as I said: use a reference for that. Reference produces a clean compilation error, not some runtime abend.
Summary
Fixes a set of warnings reported by the Svacer static analyzer. (Duplicate for unstable branch)
Changes
ftell()instead of ignoring errorsEach fix is in a separate commit, so they can be reviewed one by one.
Behavior impact
These changes address potential defects and are not intended to alter expected behavior.