-
Notifications
You must be signed in to change notification settings - Fork 38
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
Uninitialized variable in parquetAcquireSampleRowsFunc #84
Comments
Thanks @jk-intel for another report. I agree it makes sense to zero out the struct before usage. I checked the code and it seems only parquet_fdw/src/parquet_impl.cpp Line 1056 in caf7471
I created a PR #85 with the fix. |
Closing since the PR was merged. |
Hi,
The variable fdw_private in the following code is uninitialized:
parquetAcquireSampleRowsFunc(Relation relation, int /* elevel */,
HeapTuple *rows, int targrows,
double *totalrows,
double *totaldeadrows)
{
...
ParquetFdwPlanState fdw_private;
Since ParquetFdwPlanState has trivial default constructor, the members of the struct have garbage values.
The following call to get_table_options() doesn't initialize all members either. E.g. the pointer attrs_sorted may not get initialized.
I suggest to memset() the fdw_private to zero immediately after the declaration:
ParquetFdwPlanState fdw_private;
memset(&fdw_private, 0, sizeof(ParquetFdwPlanState));
(In general, there are uninitialized-at-declaration pointers scattered throughout parquet_impl.cpp. Coding style is of course subjective :), but perhaps it's better to always initialize them.)
The text was updated successfully, but these errors were encountered: