[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master fb97c50 1/2: MakeCatalog: correctly copying un
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master fb97c50 1/2: MakeCatalog: correctly copying unit string by allocation |
Date: |
Mon, 25 Nov 2019 15:13:37 -0500 (EST) |
branch: master
commit fb97c505817ab6b8e2dac36f0b0b8988234fb7bc
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>
MakeCatalog: correctly copying unit string by allocation
When the input dataset had a `UNIT' keyword, brightness related columns
like `--brightness' print that unit in their column metadata. Until now,
only a reference to this string was passed to the column, so when the
actual dataset was freed, there would be a double-free crash.
With this commit, when we need such columns, we actually allocate their
necessary space and then actually copy the string's memory, so there will
be no conflict with freeing the input dataset in the end.
This bug was found on a dataset provided by Joseph Putko.
This fixes bug #57300.
---
NEWS | 15 +++++++++++++++
bin/mkcatalog/ui.c | 4 ++--
bin/mkcatalog/upperlimit.c | 2 +-
doc/announce-acknowledge.txt | 1 +
4 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/NEWS b/NEWS
index 8ba8938..938cb10 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,21 @@ GNU Astronomy Utilities NEWS -*-
outline -*-
Copyright (C) 2015-2019 Free Software Foundation, Inc.
See the end of the file for license conditions.
+* Noteworthy changes in release X.XX (library X.X.X) (YYYY-MM-DD) [stable]
+
+** New features
+
+** Removed features
+
+** Changed features
+
+** Bugs fixed
+ bug #57300: MakeCatalog memory crash when input dataset has units.
+
+
+
+
+
* Noteworthy changes in release 0.11 (library 9.0.0) (2019-11-25) [stable]
** New features
diff --git a/bin/mkcatalog/ui.c b/bin/mkcatalog/ui.c
index c6c1a55..84bf220 100644
--- a/bin/mkcatalog/ui.c
+++ b/bin/mkcatalog/ui.c
@@ -1167,10 +1167,10 @@ ui_preparations_read_inputs(struct mkcatalogparams *p)
{
for(column=p->objectcols; column!=NULL; column=column->next)
if( !strcmp(column->unit, MKCATALOG_NO_UNIT) )
- { free(column->unit); column->unit=p->values->unit; }
+ { free(column->unit);
gal_checkset_allocate_copy(p->values->unit, &column->unit); }
for(column=p->clumpcols; column!=NULL; column=column->next)
if( !strcmp(column->unit, MKCATALOG_NO_UNIT) )
- { free(column->unit); column->unit=p->values->unit; }
+ { free(column->unit);
gal_checkset_allocate_copy(p->values->unit, &column->unit); }
}
}
diff --git a/bin/mkcatalog/upperlimit.c b/bin/mkcatalog/upperlimit.c
index 7e3c5ad..6e48f9b 100644
--- a/bin/mkcatalog/upperlimit.c
+++ b/bin/mkcatalog/upperlimit.c
@@ -401,7 +401,7 @@ upperlimit_write_check(struct mkcatalogparams *p,
gal_list_sizet_t *check_x,
"Z-axis position of random footprint's first pixel.");
s=gal_data_alloc(sarr, GAL_TYPE_FLOAT32, 1, &num, NULL, 0, p->cp.minmapsize,
p->cp.quietmmap, "RANDOM_SUM",
- p->values->unit ? p->values->unit : "input-units",
+ p->values->unit ? p->values->unit : MKCATALOG_NO_UNIT,
"Sum of pixel values over random footprint.");
diff --git a/doc/announce-acknowledge.txt b/doc/announce-acknowledge.txt
index c1922e2..5e96eda 100644
--- a/doc/announce-acknowledge.txt
+++ b/doc/announce-acknowledge.txt
@@ -1,5 +1,6 @@
Alphabetically ordered list to acknowledge in the next release.
+Joseph Putko
Copyright (C) 2015-2019 Free Software Foundation, Inc.