I agree with your interpretation, and fix. For reference, tcc_open_bf is
defined in libtcc.c. The two applicable lines are:

int buflen = initlen ? initlen : IO_BUF_SIZE;
bf = tcc_malloc(sizeof(BufferedFile) + buflen);

As presently defined, BufferedFile indicates that its last field is a
string with size IO_BUF_SIZE. But this way of allocating things looks like
it's allocating a struct with a flexible last field, so its size should be
1.

If you apply your patch, do the tests pass?

David

On Mon, Dec 15, 2014 at 3:44 AM, Lee Duhem <[email protected]> wrote:
>
> Hi,
>
> The memory needed by `buffer' will be allocated in `tcc_open_bf',
> these is no need to allocate them in BufferedFile statically.
>
> Any comment?
>
> lee
>
> _______________________________________________
> Tinycc-devel mailing list
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/tinycc-devel
>
>

-- 
 "Debugging is twice as hard as writing the code in the first place.
  Therefore, if you write the code as cleverly as possible, you are,
  by definition, not smart enough to debug it." -- Brian Kernighan
_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to