• Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • rhel-9.6
    • rhel-9.5
    • lua
    • None
    • None
    • Important
    • sst_cs_software_management
    • ssg_core_services
    • None
    • False
    • Hide

      None

      Show
      None
    • No
    • Red Hat Enterprise Linux
    • None
    • None
    • None
    • Release Note Not Required
    • None

      Findings from https://issues.redhat.com/browse/RHEL-23356

      This seems like a true positive as per the C99 standard (page 82):

      If the value being stored in an object is read from another object that overlaps in any way the storage of the first object, then the overlap shall be exact and the two objects shall have qualified or unqualified versions of a compatible type; otherwise, the behavior is undefined.

      Error: OVERLAPPING_COPY:
      lua-5.4.4/src/lcode.c:779: offset: The address of "e->u.info" is 8 bytes off of "e".
      lua-5.4.4/src/lcode.c:779: offset: The address of "e->u.var.ridx" is 8 bytes off of "e".
      lua-5.4.4/src/lcode.c:779: overlapping_assignment: Assigning "e->u.var.ridx" to "e->u.info", which have overlapping memory locations and different types.
      lua-5.4.4/src/lcode.c:779: target_type: "e->u.info" has type "int".
      lua-5.4.4/src/lcode.c:779: source_type: "e->u.var.ridx" has type "unsigned char".
      #  777|       }
      #  778|       case VLOCAL: {  /* already in a register */
      #  779|->       e->u.info = e->u.var.ridx;
      #  780|         e->k = VNONRELOC;  /* becomes a non-relocatable value */
      #  781|         break;
      
      Error: OVERLAPPING_COPY:
      lua-5.4.4/src/lcode.c:1286: offset: The address of "t->u.ind.t" is 10 bytes off of "t".
      lua-5.4.4/src/lcode.c:1286: offset: The address of "t->u.info" is 8 bytes off of "t".
      lua-5.4.4/src/lcode.c:1286: overlapping_assignment: Assigning "t->u.info" to "t->u.ind.t", which have overlapping memory locations.
      # 1284|       luaK_exp2anyreg(fs, t);  /* put it in a register */
      # 1285|     if (t->k == VUPVAL) {
      # 1286|->     t->u.ind.t = t->u.info;  /* upvalue index */
      # 1287|       t->u.ind.idx = k->u.info;  /* literal string */
      # 1288|       t->k = VINDEXUP;
      

      For reference, this is the expdesc struct definition in src/lcode.c:

      typedef struct expdesc {
        expkind k;
        union {
          lua_Integer ival;    /* for VKINT */
          lua_Number nval;  /* for VKFLT */
          TString *strval;  /* for VKSTR */
          int info;  /* for generic use */
          struct {  /* for indexed variables */
            short idx;  /* index (R or "long" K) */
            lu_byte t;  /* table (register or upvalue) */
          } ind;
          struct {  /* for local variables */
            lu_byte ridx;  /* register holding the variable */
            unsigned short vidx;  /* compiler index (in 'actvar.arr')  */
          } var;
        } u;
        int t;  /* patch list of 'exit when true' */
        int f;  /* patch list of 'exit when false' */
      } expdesc;
      

            packaging-team-maint packaging-team-maint
            mdomonko@redhat.com Michal Domonkos
            packaging-team-maint packaging-team-maint
            bot rhel-cs-apps-subsystem-qe bot rhel-cs-apps-subsystem-qe
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: