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

Fix memory overflow #3355

Merged
merged 1 commit into from Jun 23, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/hypertable_compression.c
Expand Up @@ -4,6 +4,7 @@
* LICENSE-APACHE for a copy of the license.
*/
#include <postgres.h>
#include <utils/builtins.h>

#include "hypertable.h"
#include "hypertable_cache.h"
Expand Down Expand Up @@ -175,6 +176,7 @@ ts_hypertable_compression_rename_column(int32 htid, char *old_column_name, char

ts_scanner_foreach(&iterator)
{
NameData name_new_column_name;
bool isnull;
TupleInfo *ti = ts_scan_iterator_tuple_info(&iterator);
Datum datum = slot_getattr(ti->slot, Anum_hypertable_compression_attname, &isnull);
Expand All @@ -191,8 +193,9 @@ ts_hypertable_compression_rename_column(int32 htid, char *old_column_name, char
tuple = ts_scanner_fetch_heap_tuple(ti, false, &should_free);
heap_deform_tuple(tuple, tupdesc, values, isnulls);

namestrcpy(&name_new_column_name, new_column_name);
values[AttrNumberGetAttrOffset(Anum_hypertable_compression_attname)] =
CStringGetDatum(new_column_name);
NameGetDatum(&name_new_column_name);
repl[AttrNumberGetAttrOffset(Anum_hypertable_compression_attname)] = true;
new_tuple = heap_modify_tuple(tuple, tupdesc, values, isnulls, repl);
ts_catalog_update(ti->scanrel, new_tuple);
Expand Down