gnuastro-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-devel] [bug #52544] Incorrect sanity check in lib/data.c


From: Mohammad Akhlaghi
Subject: [gnuastro-devel] [bug #52544] Incorrect sanity check in lib/data.c
Date: Tue, 28 Nov 2017 06:31:12 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0

Update of bug #52544 (project gnuastro):

             Assigned to:                    None => vvm                    

    _______________________________________________________

Follow-up Comment #1:

Thanks a lot Vladimir, very good point! This had slipped through my fingers
and I am really happy your precision in finding such issues helped us find
it.

We don't want a dimension to have a value of zero or negative, but as you
rightfully mentioned, `dsize[]' has a type of `size_t'. So I suggest the
following:

1. To convert the `<=0' check to `==0' and correct the error message to only
mention a zero-length dimension.

2. For cases where the user has (mistakenly) given a negative value, we can do
a check like what you mentioned (with `SOME_LIMIT'). However, I feel that it
would be more robust if we just print a warning (to `stderr') instead of
aborting with an error. If the value is indeed negative, later processing
steps (for example allocation) should breakdown and abort the program. About
the value of SOME_LIMIT, how about using half the maximum value of `size_t' on
the system (32-bit or 64-bit)?

What do you think? If this is ok, since you found the issue, can you implement
it so I merge it into master?

Thanks again for so nicely detecting such issues :-)

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?52544>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]