[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master 8ff37cf: Correct type when storing value of mo
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master 8ff37cf: Correct type when storing value of mode in MakeProfiles |
Date: |
Sat, 15 Jul 2017 18:08:47 -0400 (EDT) |
branch: master
commit 8ff37cf415963a2d6f1268ab190eb79755d37157
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>
Correct type when storing value of mode in MakeProfiles
the `mode' element of the `mkprofparams' (defined in MakeProfile's
`main.h') was defined as `uint8_t', but in `ui_parse_coordinate_mode', it
was being read as an `int'. So it would crash on many systems (older
compilers).
This was found thanks to crash reports of Debian for Gnuastro 0.3.31.
This fixes bug #51476.
---
NEWS | 3 +++
bin/mkprof/ui.c | 6 +++---
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/NEWS b/NEWS
index 9783341..cc5d6c6 100644
--- a/NEWS
+++ b/NEWS
@@ -85,6 +85,9 @@ GNU Astronomy Utilities NEWS -*-
outline -*-
Improper types for function code in MakeProfiles (bug #51467).
+ Crashes on 32-bit and big-endian systems (bug #51476).
+
+
diff --git a/bin/mkprof/ui.c b/bin/mkprof/ui.c
index d7e1bb3..f1c3b66 100644
--- a/bin/mkprof/ui.c
+++ b/bin/mkprof/ui.c
@@ -453,14 +453,14 @@ ui_parse_coordinate_mode(struct argp_option *option, char
*arg,
/* We want to print the stored values. */
if(lineno==-1)
{
- gal_checkset_allocate_copy( *(int *)(option->value)==MKPROF_MODE_IMG
+ gal_checkset_allocate_copy( *(uint8_t *)(option->value)==MKPROF_MODE_IMG
? "img" : "wcs", &outstr );
return outstr;
}
else
{
- if (!strcmp(arg, "img")) *(int *)(option->value)=MKPROF_MODE_IMG;
- else if (!strcmp(arg, "wcs")) *(int *)(option->value)=MKPROF_MODE_WCS;
+ if (!strcmp(arg, "img")) *(uint8_t
*)(option->value)=MKPROF_MODE_IMG;
+ else if (!strcmp(arg, "wcs")) *(uint8_t
*)(option->value)=MKPROF_MODE_WCS;
else
error_at_line(EXIT_FAILURE, 0, filename, lineno, "`%s' (value to "
"`--mode') not recognized as a coordinate standard "
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnuastro-commits] master 8ff37cf: Correct type when storing value of mode in MakeProfiles,
Mohammad Akhlaghi <=