================================================================= ==582204==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x73e30630a270 at pc 0x73e30ad7f303 bp 0x7ffe8e8c2010 sp 0x7ffe8e8c17b8 WRITE of size 4 at 0x73e30630a270 thread T0 #0 0x73e30ad7f302 in memcpy ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors_memintrinsics.inc:115 #1 0x73e308ae90bf in std::basic_streambuf >::xsgetn(char*, long) (/lib/x86_64-linux-gnu/libstdc++.so.6+0x1670bf) (BuildId: ca77dae775ec87540acd7218fa990c40d1c94ab1) #2 0x73e308aac0e9 in std::basic_filebuf >::xsgetn(char*, long) (/lib/x86_64-linux-gnu/libstdc++.so.6+0x12a0e9) (BuildId: ca77dae775ec87540acd7218fa990c40d1c94ab1) #3 0x73e308aba140 in std::istream::read(char*, long) (/lib/x86_64-linux-gnu/libstdc++.so.6+0x138140) (BuildId: ca77dae775ec87540acd7218fa990c40d1c94ab1) #4 0x5b38d54f7d83 in ggml_common_quantize_0(std::basic_ifstream >&, std::basic_ofstream >&, ggml_ftype, std::vector, std::allocator >, std::allocator, std::allocator > > > const&, std::vector, std::allocator >, std::allocator, std::allocator > > > const&) /workspace/GGML/repos/ggml/examples/common-ggml.cpp:114 #5 0x5b38d54e3e94 in gpt2_model_quantize(std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&, ggml_ftype) /workspace/GGML/repos/ggml/examples/gpt-2/quantize.cpp:125 #6 0x5b38d54e4cc3 in main /workspace/GGML/repos/ggml/examples/gpt-2/quantize.cpp:166 #7 0x73e3081841c9 (/lib/x86_64-linux-gnu/libc.so.6+0x2a1c9) (BuildId: 274eec488d230825a136fa9c4d85370fed7a0a5e) #8 0x73e30818428a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28a) (BuildId: 274eec488d230825a136fa9c4d85370fed7a0a5e) #9 0x5b38d54e0324 in _start (/workspace/GGML/continued2/builds/ggml-asan/bin/gpt-2-quantize+0x190324) (BuildId: 07a444b619432092af6f73b92317ac002ce283d8) Address 0x73e30630a270 is located in stack of thread T0 at offset 624 in frame #0 0x5b38d54f6ade in ggml_common_quantize_0(std::basic_ifstream >&, std::basic_ofstream >&, ggml_ftype, std::vector, std::allocator >, std::allocator, std::allocator > > > const&, std::vector, std::allocator >, std::allocator, std::allocator > > > const&) /workspace/GGML/repos/ggml/examples/common-ggml.cpp:46 This frame has 16 object(s): [32, 33) '' [48, 52) 'n_dims' (line 99) [64, 68) 'length' (line 100) [80, 84) 'ttype' (line 101) [96, 104) '__for_begin' (line 126) [128, 136) '__for_end' (line 126) [160, 168) '__for_begin' (line 134) [192, 200) '__for_end' (line 134) [224, 248) 'work' (line 92) [288, 312) 'data_u8' (line 94) [352, 376) 'data_f16' (line 95) [416, 440) 'data_f32' (line 96) [480, 512) '' [544, 576) '' [608, 624) 'ne' (line 112) <== Memory access at offset 624 overflows this variable [640, 672) 'name' (line 118) 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 ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors_memintrinsics.inc:115 in memcpy Shadow bytes around the buggy address: 0x73e306309f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x73e30630a000: f1 f1 f1 f1 01 f2 04 f2 04 f2 04 f2 00 f2 f2 f2 0x73e30630a080: 00 f2 f2 f2 00 f2 f2 f2 00 f2 f2 f2 00 00 00 f2 0x73e30630a100: f2 f2 f2 f2 00 00 00 f2 f2 f2 f2 f2 00 00 00 f2 0x73e30630a180: f2 f2 f2 f2 00 00 00 f2 f2 f2 f2 f2 00 00 00 00 =>0x73e30630a200: f2 f2 f2 f2 00 00 00 00 f2 f2 f2 f2 00 00[f2]f2 0x73e30630a280: 00 00 00 00 f3 f3 f3 f3 00 00 00 00 00 00 00 00 0x73e30630a300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x73e30630a380: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x73e30630a400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x73e30630a480: 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 ==582204==ABORTING