[wcstools] 01/02: Fix crash and undefined behaviour with imstar
Ole Streicher
olebole at moszumanska.debian.org
Fri Jun 12 12:31:07 UTC 2015
This is an automated email from the git hooks/post-receive script.
olebole pushed a commit to branch debian
in repository wcstools.
commit bad9a9f60e8952355d888f8680abdef010adc1a6
Author: Ole Streicher <olebole at debian.org>
Date: Fri Jun 12 14:19:48 2015 +0200
Fix crash and undefined behaviour with imstar
---
debian/changelog | 6 ++++++
debian/patches/fix_RASortStars.patch | 14 ++++++++++++++
debian/patches/fix_sprintf.patch | 36 ++++++++++++++++++++++++++++++++++++
debian/patches/series | 2 ++
debian/tests/wcstools-test | 4 ++--
5 files changed, 60 insertions(+), 2 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index ec13054..995f1a5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+wcstools (3.9.2-4) unstable; urgency=low
+
+ * Fix crash and undefined behaviour with imstar
+
+ -- Ole Streicher <olebole at debian.org> Fri, 12 Jun 2015 14:18:26 +0200
+
wcstools (3.9.2-3) unstable; urgency=low
* Run CI test during package build as well
diff --git a/debian/patches/fix_RASortStars.patch b/debian/patches/fix_RASortStars.patch
new file mode 100644
index 0000000..27a912f
--- /dev/null
+++ b/debian/patches/fix_RASortStars.patch
@@ -0,0 +1,14 @@
+Author: Ole Streicher <olebole at debian.org>
+Description: Fix uninitialized value for haspm in RASortStars()
+ This fixes a crash with 'imstar -s'.
+--- a/libwcs/sortstar.c
++++ b/libwcs/sortstar.c
+@@ -417,6 +417,8 @@
+ hasnum = 1;
+ if (spra != NULL && spdec != NULL)
+ haspm = 1;
++ else
++ haspm = 0;
+ if (sx != NULL && sy != NULL)
+ hasxy = 1;
+ else
diff --git a/debian/patches/fix_sprintf.patch b/debian/patches/fix_sprintf.patch
new file mode 100644
index 0000000..4ec5993
--- /dev/null
+++ b/debian/patches/fix_sprintf.patch
@@ -0,0 +1,36 @@
+Author: Ole Streicher <olebole at debian.net>
+Description: Fix overlappong buffers in sprintf
+ In sprintf, overlapping buffers lead to undefined behaviour.
+ This causes different results on Debian and Ubuntu.
+--- a/imstar.c
++++ b/imstar.c
+@@ -818,7 +818,7 @@
+ sprintf (headline, "%7.2f %7.2f %6.2f %d",
+ sx[i],sy[i],smag[i],sp[i]);
+ if (iswcs (wcs))
+- sprintf (headline, "%s %s %s", headline, rastr, decstr);
++ sprintf (headline + strlen(headline), " %s %s", rastr, decstr);
+ if (wfile)
+ fprintf (fd, "%s\n", headline);
+ else
+@@ -827,14 +827,14 @@
+ else {
+ sprintf (headline, "%3d %s %s %6.2f", i+1,rastr,decstr,smag[i]);
+ if (wcs->nxpix < 100.0 && wcs->nypix > 100.0)
+- sprintf (headline, "%s %5.2f %5.2f %d",
+- headline, sx[i],sy[i], sp[i]);
++ sprintf (headline + strlen(headline), " %5.2f %5.2f %d",
++ sx[i],sy[i], sp[i]);
+ else if (wcs->nxpix < 1000.0 && wcs->nypix < 1000.0)
+- sprintf (headline, "%s %6.2f %6.2f %d",
+- headline, sx[i],sy[i], sp[i]);
++ sprintf (headline + strlen(headline), " %6.2f %6.2f %d",
++ sx[i],sy[i], sp[i]);
+ else
+- sprintf (headline, "%s %7.2f %7.2f %d",
+- headline, sx[i],sy[i], sp[i]);
++ sprintf (headline + strlen(headline), " %7.2f %7.2f %d",
++ sx[i],sy[i], sp[i]);
+ if (wfile)
+ fprintf (fd, "%s\n", headline);
+ else
diff --git a/debian/patches/series b/debian/patches/series
index 0ecbbc2..96ece76 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -5,3 +5,5 @@ use_abort.patch
fix_mayhem.patch
fix_compiler_warnings.patch
fix_wcsinit_crash.patch
+fix_sprintf.patch
+fix_RASortStars.patch
diff --git a/debian/tests/wcstools-test b/debian/tests/wcstools-test
index ce07833..1bd9f76 100755
--- a/debian/tests/wcstools-test
+++ b/debian/tests/wcstools-test
@@ -169,8 +169,8 @@ testProg sumpix $fitsfile <<EOF
EOF
testProg imstar -n 2 $fitsfile <<EOF
- 283.50 1005.72 65535
- 626.83 819.92 31511
+ 1 12:27:21.699 +44:11:02.52 -12.85 283.50 1005.72 65535
+ 2 12:27:00.269 +44:08:57.31 -9.13 626.83 819.92 31511
EOF
testProg skycoor 9:55:41.600 +69:00:27.99 J2000 9:54:53.258 +69:03:49.30 J2000 <<EOF
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-astro/packages/wcstools.git
More information about the debian-science-commits
mailing list