Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-7742

Fix misaligned address in wt3184_dup_index_collator/main.c

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • WT10.0.1, 4.4.8, 5.0.2, 5.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • 2
    • Storage - Ra 2021-07-12

      Fallout of errors coming from new UBSAN Build variants in WT-7552. Within test/csuite/wt3184_dup_index_collator/main.c.

       [2021/06/28 05:05:12.512] ../../../test/csuite/wt3184_dup_index_collator/main.c:66:35: runtime error: load of misaligned address 0x0000014809c1 for type 'int32_t' (aka 'int'), which requires 4 byte alignment
       [2021/06/28 05:05:12.512] 0x0000014809c1: note: pointer points here
       [2021/06/28 05:05:12.512]  00 00 00  84 11 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  f1 00 00 00 00
       [2021/06/28 05:05:12.512]               ^
       [2021/06/28 05:05:12.512]     #0 0x423f1b in print_int_item /data/mci/ca8a7d950f1bf956b286e945a18a82e9/wiredtiger/build_posix/test/csuite/../../../test/csuite/wt3184_dup_index_collator/main.c:66:35
       [2021/06/28 05:05:12.512]     #1 0x423bb8 in index_compare /data/mci/ca8a7d950f1bf956b286e945a18a82e9/wiredtiger/build_posix/test/csuite/../../../test/csuite/wt3184_dup_index_collator/main.c:81:5
       [2021/06/28 05:05:12.512]     #2 0x7f414e423935 in __wt_compare /data/mci/ca8a7d950f1bf956b286e945a18a82e9/wiredtiger/build_posix/../src/include/btree_cmp_inline.h:111:13
       [2021/06/28 05:05:12.512]     #3 0x7f414e42510b in __search_insert_append /data/mci/ca8a7d950f1bf956b286e945a18a82e9/wiredtiger/build_posix/../src/btree/row_srch.c:43:5
       [2021/06/28 05:05:12.512]     #4 0x7f414e422310 in __wt_row_search /data/mci/ca8a7d950f1bf956b286e945a18a82e9/wiredtiger/build_posix/../src/btree/row_srch.c:478:9
       [2021/06/28 05:05:12.512]     #5 0x7f414e29b184 in __cursor_row_search /data/mci/ca8a7d950f1bf956b286e945a18a82e9/wiredtiger/build_posix/../src/btree/bt_cursor.c:385:5
       [2021/06/28 05:05:12.512]     #6 0x7f414e29ef96 in __wt_btcur_search_near /data/mci/ca8a7d950f1bf956b286e945a18a82e9/wiredtiger/build_posix/../src/btree/bt_cursor.c:671:13
       [2021/06/28 05:05:12.512]     #7 0x7f414e526a0e in __curfile_search_near /data/mci/ca8a7d950f1bf956b286e945a18a82e9/wiredtiger/build_posix/../src/cursor/cur_file.c:232:5
       [2021/06/28 05:05:12.512]     #8 0x7f414e56494d in __curindex_search /data/mci/ca8a7d950f1bf956b286e945a18a82e9/wiredtiger/build_posix/../src/cursor/cur_index.c:234:5
       [2021/06/28 05:05:12.512]     #9 0x423396 in main /data/mci/ca8a7d950f1bf956b286e945a18a82e9/wiredtiger/build_posix/test/csuite/../../../test/csuite/wt3184_dup_index_collator/main.c:147:5
       [2021/06/28 05:05:12.512]     #10 0x7f414cab5bf6 in __libc_start_main /build/glibc-S9d2JN/glibc-2.27/csu/../csu/libc-start.c:310
       [2021/06/28 05:05:12.512]     #11 0x403629 in _start (/data/mci/ca8a7d950f1bf956b286e945a18a82e9/wiredtiger/build_posix/test/csuite/test_wt3184_dup_index_collator+0x403629)
      

      The error is pointing towards the type cast done within:

      static void
      print_int_item(const char *str, const WT_ITEM *item)
      {
          if (item->size > 0) {
              testutil_assert(item->size == sizeof(int32_t));
              printf("%s%" PRId32, str, *(int32_t *)item->data);
          } else
              printf("%s<empty>", str);
      }
      

      Verify with UBSAN build again once fixed.

            Assignee:
            alexey.anisimov@mongodb.com Alexey Anisimov (Inactive)
            Reporter:
            jie.chen@mongodb.com Jie Chen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: