Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/common/DynamicStrings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ unsigned makeDynamicStrings(unsigned length, ISC_STATUS* const dst, const ISC_ST
case isc_arg_cstring:
fb_assert(string);
*to++ = (ISC_STATUS)(IPTR) string;
if (!string)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a dead code. The loop above makes sure that string is not nullptr.

break;
memcpy(string, reinterpret_cast<const char*>(from[1]), from[0]);
string += *from++;
*string++ = '\0';
Expand All @@ -97,6 +99,8 @@ unsigned makeDynamicStrings(unsigned length, ISC_STATUS* const dst, const ISC_ST
case isc_arg_sql_state:
fb_assert(string);
*to++ = (ISC_STATUS)(IPTR) string;
if (!string)
break;
strcpy(string, reinterpret_cast<const char*>(*from));
string += strlen(string);
string++;
Expand Down
3 changes: 2 additions & 1 deletion src/gpre/obj_cxx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3368,7 +3368,8 @@ static void gen_t_start( const act* action, int column)

if (trans->tra_db_count == 1)
{
printa(column, "%s = %s->startTransaction(%s, %d, fb_tpb_%d);",
if (trans->tra_tpb)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And what's else? Don't start the transaction at all?..

printa(column, "%s = %s->startTransaction(%s, %d, fb_tpb_%d);",
trans->tra_handle ? trans->tra_handle : gpreGlob.transaction_name,
trans->tra_tpb->tpb_database->dbb_name->sym_string, vector,
trans->tra_tpb->tpb_length, trans->tra_tpb->tpb_ident);
Expand Down
6 changes: 6 additions & 0 deletions src/jrd/lck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1049,6 +1049,9 @@ static Lock* hash_get_lock(Lock* lock, USHORT* hash_slot, Lock*** prior)

// if no collisions found, we're done

if (!att->att_compatibility_table)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

att_compatibility_table is surely initialized in line 1042. Another dead code.

return NULL;

Lock* match = (*att->att_compatibility_table)[hash_value];
if (!match)
return NULL;
Expand Down Expand Up @@ -1333,6 +1336,9 @@ static USHORT internal_downgrade(thread_db* tdbb, CheckStatusWrapper* statusVect

// if we can convert to that level, set all identical locks as having that level

if (!first || !first->lck_physical)
return NULL;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not NULL but a proper LCK_* constant here. Which one is "proper"? That's the question. Investigation also can find out if cases when first is nullptr are possible at all. BTW, lck_physical is not a pointer.


if (level < first->lck_physical)
{
if (dbb->lockManager()->convert(tdbb, statusVector, first->lck_id, level, LCK_NO_WAIT,
Expand Down
2 changes: 1 addition & 1 deletion src/jrd/replication/Applier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@ void Applier::storeBlob(thread_db* tdbb, TraNumber traNum, bid* blobId,
fb_assert(blob->blb_flags & BLB_temporary);
fb_assert(!(blob->blb_flags & BLB_closed));

if (length)
if (blob && length)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...and if blob is nullptr - still get AV on BLB_close call. Instead else branch must be added to if in line 983 with bugcheck logging and bail.

blob->BLB_put_segment(tdbb, data, length);
else
blob->BLB_close(tdbb);
Expand Down