-
-
Notifications
You must be signed in to change notification settings - Fork 270
Added default initialization to avoid garbage values #8973
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 11 commits
fd6857c
a6988a4
4e97b5c
7ec3f4b
a6db65e
0fe3203
533aab5
64963c8
bfa093b
f335f7c
30810af
d84f8db
a2e9f22
cfcb213
f4c7ab2
7f2329f
232b565
d3d0952
ad8a3ad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1608,7 +1608,7 @@ bool get_acl(BurpGlobals* tdgbl, const TEXT* owner_nm, ISC_QUAD* blob_id, ISC_QU | |
|
|
||
| ULONG length = 0; | ||
| UCHAR item; | ||
| USHORT max_segment; | ||
| USHORT max_segment = 0; | ||
| ULONG num_segments; | ||
| const UCHAR* p = blob_info; | ||
|
|
||
|
|
@@ -1783,7 +1783,7 @@ void get_array(BurpGlobals* tdgbl, burp_rel* relation, UCHAR* record_buffer) | |
| SLONG fld_ranges[2 * MAX_DIMENSION]; | ||
| SLONG slice_length = 0; | ||
| SLONG *range; | ||
| const SLONG* end_ranges; | ||
| const SLONG* end_ranges = nullptr; | ||
|
dyemanov marked this conversation as resolved.
Outdated
|
||
| scan_attr_t scan_next_attr; | ||
| skip_init(&scan_next_attr); | ||
| att_type attribute; | ||
|
|
@@ -1851,7 +1851,7 @@ void get_array(BurpGlobals* tdgbl, burp_rel* relation, UCHAR* record_buffer) | |
| SLONG last_element_dim[MAX_DIMENSION]; | ||
| if (return_length != slice_length) | ||
| { | ||
| int upper, lower; | ||
| int upper = 0, lower = 0; | ||
|
dyemanov marked this conversation as resolved.
Outdated
|
||
| // | ||
| // Ugh! The full array wasn't returned and versions of gbak prior to | ||
| // V3.2I don't explicitly signal this. We must recompute the top | ||
|
|
@@ -3386,7 +3386,7 @@ void get_data(BurpGlobals* tdgbl, burp_rel* relation, WriteRelationReq* req) | |
| } | ||
| } | ||
|
|
||
| UCHAR* p; | ||
| UCHAR* p = nullptr; | ||
| if (tdgbl->gbl_sw_transportable) | ||
| { | ||
| if (get(tdgbl) != att_xdr_length) | ||
|
|
@@ -9097,7 +9097,7 @@ bool get_db_creator(BurpGlobals* tdgbl) | |
| att_type attribute; | ||
| scan_attr_t scan_next_attr; | ||
| TEXT usr[GDS_NAME_LEN]; | ||
| SSHORT uType; | ||
| SSHORT uType = 0; | ||
|
dyemanov marked this conversation as resolved.
|
||
| bool userSet, typeSet; | ||
|
|
||
| userSet = typeSet = false; | ||
|
|
@@ -9422,7 +9422,7 @@ bool get_trigger_old (BurpGlobals* tdgbl, burp_rel* relation) | |
| * Get a trigger definition for a relation. | ||
| * | ||
| **************************************/ | ||
| enum trig_t type; | ||
| enum trig_t type = trig_none; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For completeness you should also add a check that a meaningful value was assigned below and throw an error if
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd better use |
||
| att_type attribute; | ||
| TEXT name[GDS_NAME_LEN]; | ||
| scan_attr_t scan_next_attr; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -227,7 +227,8 @@ static void checkForeignKeyTempScope(thread_db* tdbb, jrd_tra* transaction, | |
| { | ||
| AutoCacheRequest request(tdbb, drq_l_rel_info, DYN_REQUESTS); | ||
| QualifiedName masterRelName; | ||
| rel_t masterType, childType; | ||
| rel_t masterType = rel_persistent; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This function is basically wrong and will fail in the case if the table has several foreign keys. It must be fixed, not polished. |
||
| rel_t childType = rel_persistent; | ||
|
|
||
| FOR(REQUEST_HANDLE request TRANSACTION_HANDLE transaction) | ||
| RLC_M IN RDB$RELATION_CONSTRAINTS CROSS | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong initialization. In this case
USHRT_MAXis a safe assumption.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In backup.epp,
max_segmentis initialized with zero in the very same piece of code. If we have no reply forisc_info_blob_max_segmentand blob total length is not zero, why should we imply length beingUSHRT_MAXas you suggest?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment "Rdb sometimes gets the length messed up" suggests that total BLOB length can be evaluated wrongly. In this case using buffer of maximum allowed segment size is better.
I suspect that this piece of code exists only to avoid allocation of 64k memory unconditionally. It had sense in the previous century but not today.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its all makes no sense and is a waste of time. Vars gets its values from server response. There can be exactly one reason for any item to have no response - some fatal error. This is API contract. If it become broken, many places in code will fail.
Note, the title say: "...to avoid garbage values" - this code doesn't prevent any kind of garbage values.
Also, why
max_segmentgets default, whilenum_segments- not ? Looks like "slightly-pregnant", sorry...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because
num_segmentsis not used at all. This routine still can handle only ACLs of max size 64k. Perhaps, @AlexPeshkoff missed it when fixed #2651.