Skip to content
  • Alan Modra's avatar
    PR25651, objcopy SIGSEGV in copy_object · 9cc89dc0
    Alan Modra authored
    With the right set of options, the second block of code dealing with
    padding can see a different section count.  So don't use the new count.
    Since I was editing those lines, I've also changed the code allocating
    arrays a little.
        array = malloc (n * sizeof (*array));
    for an array of ints is just better than
        array = malloc (n * sizeof (int));
    It's easier to write correctly in the first place and more robust
    against code changes that might modify the array element type.
    
    	PR 25651
    	* objcopy.c (copy_object): Test "gaps" not gap_fill_set or
    	pad_to_set on second block of code dealing with padding.
    	Replace "c" with "num_sec" and don't recalculate number of
    	sections on second block.  Size arrays using sizeof (element)
    	rather than sizeof (element type).
    9cc89dc0
To find the state of this project's repository at the time of any of these versions, check out the tags.