Skip to content
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

Backport to 2.10.x: #5317: Fix some incorrect memory handling #5372

Merged
merged 1 commit into from
Mar 3, 2023

Conversation

timescale-automation
Copy link

This is an automated backport of #5317: Fix some incorrect memory handling.
The original issue is #5311.
This PR will be merged automatically after all the relevant CI checks pass. If this fix should not be backported, or will be backported manually, just close this PR. You can use the backport branch to add your changes, it won't be modified automatically anymore.

For more details, please see the documentation

Original description

Fix some incorrect memory handling

While running TimescaleDB under valgrind I've found two cases of incorrect memory handling.

Case 1: When creating timescaledb extension, during the insertion of metadata there is some junk in memory that is not zeroed before writing there.
Changes in metadata.c fix this.

Case 2: When executing GRANT smth ON ALL TABLES IN SCHEMA some_schema and deconstructing this statement into granting to individual tables, process of copying names of those tables is wrong. Currently, you aren't copying the data itself, but an address to data on a page in some buffer. There's a problem - when the page in this buffer changes, copied address would lead to wrong data. Changes in process_utility.c fix this by allocating memory and then copying needed relname there.

Fixes #5311

Disable-check: commit-count

@timescale-automation timescale-automation added the is-auto-backport PR created by backport automation label Mar 1, 2023
@timescale-automation timescale-automation enabled auto-merge (rebase) March 1, 2023 06:34
@codecov
Copy link

codecov bot commented Mar 1, 2023

Codecov Report

❗ No coverage uploaded for pull request base (2.10.x@8b549b0). Click here to learn what that means.
The diff coverage is n/a.

❗ Current head d373560 differs from pull request most recent head fb2b4d3. Consider uploading reports for the commit fb2b4d3 to get more accurate results

@@            Coverage Diff            @@
##             2.10.x    #5372   +/-   ##
=========================================
  Coverage          ?   90.68%           
=========================================
  Files             ?      225           
  Lines             ?    51999           
  Branches          ?        0           
=========================================
  Hits              ?    47156           
  Misses            ?     4843           
  Partials          ?        0           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@horzsolt horzsolt added this to the TimescaleDB 2.10.1 milestone Mar 2, 2023
While running TimescaleDB under valgrind I've found
two cases of incorrect memory handling.

Case 1: When creating timescaledb extension, during the insertion of
metadata there is some junk in memory that is not zeroed
before writing there.
Changes in metadata.c fix this.

Case 2: When executing GRANT smth ON ALL TABLES IN SCHEMA some_schema
and deconstructing this statement into granting to individual tables,
process of copying names of those tables is wrong.
Currently, you aren't copying the data itself, but an address to data
on a page in some buffer. There's a problem - when the page in this
buffer changes, copied address would lead to wrong data.
Changes in process_utility.c fix this by allocating memory and then
copying needed relname there.

Fixes #5311

(cherry picked from commit 0746517)
@timescale-automation timescale-automation merged commit 7dbd1d6 into 2.10.x Mar 3, 2023
@timescale-automation timescale-automation deleted the backport/2.10.x/5317 branch March 3, 2023 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is-auto-backport PR created by backport automation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants