main: seed = 1778590707 main: loaded image '/workspace/GGML/repos/ggml/examples/sam/example.jpg' (680 x 453) sam_image_preprocess: scale = 0.664062 main: preprocessed image (1024 x 1024) sam_model_load: loading model from '/workspace/GGML/continued/lab/ggml_sam_ndims64_unknown.bin' - please wait ... operator(): ggml ctx size = 202.33 MB sam_model_load: /workspace/GGML/repos/ggml/examples/sam/sam.cpp:1058:21: runtime error: index 4 out of bounds for type 'long int [4]' /workspace/GGML/repos/ggml/examples/sam/sam.cpp:1058:23: runtime error: store to address 0x70a6213023f0 with insufficient space for an object of type 'int64_t' 0x70a6213023f0: note: pointer points here 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ^ ================================================================= ==506898==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x70a6213023f0 at pc 0x5f6b3f8f5f50 bp 0x7ffd81e5c920 sp 0x7ffd81e5c910 WRITE of size 8 at 0x70a6213023f0 thread T0 #0 0x5f6b3f8f5f4f in sam_model_load(sam_params const&, sam_model&) /workspace/GGML/repos/ggml/examples/sam/sam.cpp:1058 #1 0x5f6b3f914c21 in main /workspace/GGML/repos/ggml/examples/sam/sam.cpp:2273 #2 0x70a622d841c9 (/lib/x86_64-linux-gnu/libc.so.6+0x2a1c9) (BuildId: 274eec488d230825a136fa9c4d85370fed7a0a5e) #3 0x70a622d8428a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28a) (BuildId: 274eec488d230825a136fa9c4d85370fed7a0a5e) #4 0x5f6b3f848914 in _start (/workspace/GGML/continued/builds/ggml-asan/bin/sam+0x14a914) (BuildId: 503e35b1dce8c894a3cca8cacbb5d63a0f6e1f6b) Address 0x70a6213023f0 is located in stack of thread T0 at offset 9200 in frame #0 0x5f6b3f8dba38 in sam_model_load(sam_params const&, sam_model&) /workspace/GGML/repos/ggml/examples/sam/sam.cpp:508 This frame has 182 object(s): [48, 49) '' [64, 65) '' [80, 81) '' [96, 97) '' [112, 113) '' [128, 129) '' [144, 145) '' [160, 161) '' [176, 177) '' [192, 193) '' [208, 209) '' [224, 225) '' [240, 241) '' [256, 257) '' [272, 273) '' [288, 289) '' [304, 305) '' [320, 321) '' [336, 337) '' [352, 353) '' [368, 369) '' [384, 385) '' [400, 401) '' [416, 417) '' [432, 433) '' [448, 449) '' [464, 465) '' [480, 481) '' [496, 497) '' [512, 513) '' [528, 529) '' [544, 545) '' [560, 561) '' [576, 577) '' [592, 593) '' [608, 609) '' [624, 625) '' [640, 641) '' [656, 657) '' [672, 676) 'magic' (line 519) [688, 692) 'n_dims' (line 1041) [704, 708) 'length' (line 1042) [720, 724) 'ftype' (line 1043) [736, 740) 'ne_cur' (line 1056) [752, 760) '' [784, 792) '' [816, 824) '' [848, 872) 'params' (line 720) [912, 944) '' [976, 1008) '' [1040, 1072) '' [1104, 1136) '' [1168, 1200) '' [1232, 1264) '' [1296, 1328) '' [1360, 1392) '' [1424, 1456) '' [1488, 1520) '' [1552, 1584) '' [1616, 1648) '' [1680, 1712) '' [1744, 1776) '' [1808, 1840) '' [1872, 1904) '' [1936, 1968) '' [2000, 2032) '' [2064, 2096) '' [2128, 2160) '' [2192, 2224) '' [2256, 2288) '' [2320, 2352) '' [2384, 2416) '' [2448, 2480) '' [2512, 2544) '' [2576, 2608) '' [2640, 2672) '' [2704, 2736) '' [2768, 2800) '' [2832, 2864) '' [2896, 2928) '' [2960, 2992) '' [3024, 3056) '' [3088, 3120) '' [3152, 3184) '' [3216, 3248) '' [3280, 3312) '' [3344, 3376) '' [3408, 3440) '' [3472, 3504) '' [3536, 3568) '' [3600, 3632) '' [3664, 3696) '' [3728, 3760) '' [3792, 3824) '' [3856, 3888) '' [3920, 3952) '' [3984, 4016) '' [4048, 4080) '' [4112, 4144) '' [4176, 4208) '' [4240, 4272) '' [4304, 4336) '' [4368, 4400) '' [4432, 4464) '' [4496, 4528) '' [4560, 4592) 'prefix' (line 907) [4624, 4656) '' [4688, 4720) '' [4752, 4784) '' [4816, 4848) '' [4880, 4912) '' [4944, 4976) '' [5008, 5040) '' [5072, 5104) '' [5136, 5168) '' [5200, 5232) '' [5264, 5296) '' [5328, 5360) '' [5392, 5424) '' [5456, 5488) '' [5520, 5552) '' [5584, 5616) '' [5648, 5680) '' [5712, 5744) '' [5776, 5808) '' [5840, 5872) '' [5904, 5936) '' [5968, 6000) '' [6032, 6064) '' [6096, 6128) '' [6160, 6192) '' [6224, 6256) '' [6288, 6320) '' [6352, 6384) '' [6416, 6448) '' [6480, 6512) '' [6544, 6576) '' [6608, 6640) '' [6672, 6704) '' [6736, 6768) '' [6800, 6832) '' [6864, 6896) '' [6928, 6960) '' [6992, 7024) '' [7056, 7088) '' [7120, 7152) '' [7184, 7216) '' [7248, 7280) '' [7312, 7344) '' [7376, 7408) '' [7440, 7472) '' [7504, 7536) '' [7568, 7600) '' [7632, 7664) '' [7696, 7728) '' [7760, 7792) '' [7824, 7856) '' [7888, 7920) '' [7952, 7984) '' [8016, 8048) '' [8080, 8112) 'prefix' (line 1002) [8144, 8176) '' [8208, 8240) '' [8272, 8304) '' [8336, 8368) '' [8400, 8432) '' [8464, 8496) '' [8528, 8560) '' [8592, 8624) '' [8656, 8688) '' [8720, 8752) '' [8784, 8816) '' [8848, 8880) '' [8912, 8944) '' [8976, 9008) '' [9040, 9072) '' [9104, 9136) '' [9168, 9200) 'ne' (line 1054) <== Memory access at offset 9200 overflows this variable [9232, 9264) 'name' (line 1062) [9296, 9328) '' [9360, 9392) '' [9424, 9944) 'fin' (line 511) HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork (longjmp and C++ exceptions *are* supported) SUMMARY: AddressSanitizer: stack-buffer-overflow /workspace/GGML/repos/ggml/examples/sam/sam.cpp:1058 in sam_model_load(sam_params const&, sam_model&) Shadow bytes around the buggy address: 0x70a621302100: f2 f2 f8 f8 f8 f8 f2 f2 f2 f2 f8 f8 f8 f8 f2 f2 0x70a621302180: f2 f2 f8 f8 f8 f8 f2 f2 f2 f2 f8 f8 f8 f8 f2 f2 0x70a621302200: f2 f2 f8 f8 f8 f8 f2 f2 f2 f2 f8 f8 f8 f8 f2 f2 0x70a621302280: f2 f2 f8 f8 f8 f8 f2 f2 f2 f2 f8 f8 f8 f8 f2 f2 0x70a621302300: f2 f2 f8 f8 f8 f8 f2 f2 f2 f2 f8 f8 f8 f8 f2 f2 =>0x70a621302380: f2 f2 f8 f8 f8 f8 f2 f2 f2 f2 00 00 00 00[f2]f2 0x70a621302400: f2 f2 00 00 00 00 f2 f2 f2 f2 00 00 00 00 f2 f2 0x70a621302480: f2 f2 00 00 00 00 f2 f2 f2 f2 00 00 00 00 00 00 0x70a621302500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x70a621302580: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x70a621302600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==506898==ABORTING