bugGNU Astronomy Utilities - Bugs: bug #66090, Library: endless loop in...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #66090: Library: endless loop in gal_data_copy if size=0

Submitter:  Giacomo Lorenzetti <glorenzetti>
Submitted:  Wed 14 Aug 2024 06:56:44 PM UTC
   
 
Category:  Libraries Severity:  3 - Normal
Item Group:  Crash Status:  In Progress
Privacy:  Public Assigned to:  glorenzetti
Open/Closed:  Open

Wed 14 Aug 2024 06:57:26 PM UTC, comment #1: 

A solution may be to check if size is 0 when copying, and in that case set the output array to NULL: https://gitlab.cefca.es/glorenzetti/gnuastro/-/commit/d8adaeb5ede7d1566e5bbb7be5c84567bf4ff970

Another solution, cleaner in my opinion, is to set the array to NULL when size is 0 right inside gal_data_initialize, avoiding as much as possible to have non-NULL empty arrays around: https://gitlab.cefca.es/glorenzetti/gnuastro/-/commit/e835e54b3865256fd14e415039412b9d0b1ffe55

Giacomo Lorenzetti <glorenzetti>
Group Member
Wed 14 Aug 2024 06:56:44 PM UTC, original submission:  

In the case of an empty non-NULL array in the input struct (say, an array allocated with `malloc(size * sizeof(int))`, where `size` is a variable computed elsewhere that may be zero; note also that the behaviour of `malloc(0)` is implementation defined!) the program is stuck.

Giacomo Lorenzetti <glorenzetti>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by glorenzetti (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.14-7003.
    Corresponding source code