Skip to content

updating types_members always reports an error #44

Closed

Description

@shrddr
idasql -s test_vftables3.exe.i64 -i -w
Opening: test_vftables3.exe.i64...
Database opened successfully.
IDASQL Interactive Mode
Type .help for commands, .quit to exit

idasql> SELECT member_index, member_name, member_type FROM types_members WHERE type_name = 'My' ORDER BY member_index;
+--------------+-------------+-------------+
| member_index | member_name | member_type |
+--------------+-------------+-------------+
| 0            | x           | int         |
| 1            | y           | int         |
+--------------+-------------+-------------+
2 row(s)
idasql> UPDATE types_members SET member_name = 'y_modified' WHERE type_name = 'My' AND member_index = 1;
Error: types_members: failed to save (type= member=1)
idasql> SELECT member_index, member_name, member_type FROM types_members WHERE type_name = 'My' ORDER BY member_index;
+--------------+-------------+-------------+
| member_index | member_name | member_type |
+--------------+-------------+-------------+
| 0            | x           | int         |
| 1            | y_modified  | int         |
+--------------+-------------+-------------+
2 row(s)
idasql> .quit
Database saved.

Saved i64 does contain the modified field despite the error. The UPDATE should not show the error though, this complicates debugging actual update errors.

here's what an agent thinks

  In src/lib/src/types_members.cpp:194:

  bool TypeMemberRef::save() {
      if (!valid) return false;
      tinfo_t new_tif;
      new_tif.create_udt(udt, tif.is_union() ? BTF_UNION : BTF_STRUCT);
      return new_tif.set_numbered_type(get_idati(), ordinal, NTF_REPLACE, nullptr);
  }

  set_numbered_type() returns an IDA type error code, where TERR_OK == 0. The code converts that directly to bool.

  Therefore:

  - success (TERR_OK, 0) becomes false;
  - the caller reports failed to save;
  - the rename has nevertheless already been applied.

  The correct form is:

  return new_tif.set_numbered_type(
      get_idati(), ordinal, NTF_REPLACE, nullptr
  ) == TERR_OK;

  The existing types implementation already uses the correct comparison in src/lib/src/types_base.cpp:243.

Activity

  1. added a commit that references this issue on Jul 11, 2026
    2a4b950
  2. 0xeb commented on Jul 17, 2026

    @0xeb
    Member

    Fixed for v0.0.18 (coming shortly). The UPDATE was actually succeeding — a generic error wrapper was masking the real result and surfacing a spurious "failed to save". That wrapper is removed, so successful edits report cleanly and only genuine failures carry a (specific) message. Thanks for the report, @shrddr!

  3. added 2 commits that reference this issue on Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions