1. Harald Klimach
  2. aotus
  3. Issues
Issue #2 resolved

ErrCode allocation in get_table_*_vvect procedures

jas43
created an issue

ErrCode is not allocated by the caller in get_table_real_vvect but instead is allocated to the appropriate size in get_top_real_vvect (and similarly for other get_table_*_vvect procedures).

However, if a global vector is requested but doesn't exist (so valid_args is false) then ErrCode is set in get_table_real_vvect without ever being allocated. I'm not 100% sure how to handle this but I think ErrCode should be allocated to be zero size (as happens if a non-existent vector member of a table is requested).

What do you think?

Comments (3)

  1. Harald Klimach repo owner

    Indeed, this is an issue introduced by sloppy introduction of the changed interfaces with optional arguments instead of multiple routines in a common generic interface. I hope f801ea3 is a fix for this in the way you suggested, which I think is the most reasonable approach to it.

  2. Harald Klimach repo owner

    The returned parameters for the dynamically allocated arrays are now sanitized to have 0 length, if the input arguments are invalid, resulting in the same behavior, as if the requested Lua table does not exist.

  3. Log in to comment