[parrot/parrot] 03b3d5: frontend: Be pessimistic about arguments

GitHub noreply at github.com
Thu Jan 26 05:41:00 UTC 2012

  Branch: refs/heads/master
  Home:   https://github.com/parrot/parrot
  Commit: 03b3d5fb10dcc61785a269be4e771d85a39c544e
  Author: Brian Gernhardt <brian.gernhardt at mail.rit.edu>
  Date:   2012-01-25 (Wed, 25 Jan 2012)

  Changed paths:
    M frontend/parrot2/main.c

  Log Message:
  frontend: Be pessimistic about arguments

The code to handle -o added two arguments to the final array.
However, longopt allows "-o file" to also be passed as
"--output=file".  This causes one argument to cause two to be added.
This means that we can't have the destination array be the same size
as the original.

I've decided to use the most pessimistic case for allocation, one
where every argument causes two to be added (parrot --output=file1
--output=file2 etc).  Alternative solutions include passing it as
"-o=file" instead and having prt0 handle breaking it apart, but this
is the fastest way to fix the memory overrun.

More information about the parrot-commits mailing list