Heap-Overflow in `resolveInputs`
==222==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x63100003bbf8 at pc 0x7f00d84b0936 bp 0x7ffffd5e56b0 sp 0x7ffffd5e56a0
READ of size 4 at 0x63100003bbf8 thread T0
#0 0x7f00d84b0935 in operator<<(std::ostream&, token const&) (/mnt/c/work/programming/mdtex/build_linux/mdtex+0xb0935)
#1 0x7f00d84737ba in converter::createLatex(std::experimental::filesystem::v1::__cxx11::path const&, std::experimental::filesystem::v1::__cxx11::path const&) (/mnt/c/work/programming/mdtex/build_linux/mdtex+0x737ba)
#2 0x7f00d84788bf in converter::operator()(std::experimental::filesystem::v1::__cxx11::path) (/mnt/c/work/programming/mdtex/build_linux/mdtex+0x788bf)
#3 0x7f00d8445b0b in main (/mnt/c/work/programming/mdtex/build_linux/mdtex+0x45b0b)
#4 0x7f00d6a51b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
#5 0x7f00d844f619 in _start (/mnt/c/work/programming/mdtex/build_linux/mdtex+0x4f619)
0x63100003bbf8 is located 0 bytes to the right of 78840-byte region [0x631000028800,0x63100003bbf8)
allocated by thread T0 here:
#0 0x7f00d6f1f790 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xef790)
#1 0x7f00d84a1c2d in resolveInputs(std::vector<token, std::allocator<token> >, std::vector<std::experimental::filesystem::v1::__cxx11::path, std::allocator<std::experimental::filesystem::v1::__cxx11::path> >&) (/mnt/c/work/programming/mdtex/build_linux/mdtex+0xa1c2d)
#2 0x7f00d8498274 in lexer(std::experimental::filesystem::v1::__cxx11::path const&, std::vector<std::experimental::filesystem::v1::__cxx11::path, std::allocator<std::experimental::filesystem::v1::__cxx11::path> >&) (/mnt/c/work/programming/mdtex/build_linux/mdtex+0x98274)
#3 0x7f00d84a47f2 in lex(std::experimental::filesystem::v1::__cxx11::path const&) (/mnt/c/work/programming/mdtex/build_linux/mdtex+0xa47f2)
#4 0x7f00d847277b in converter::createLatex(std::experimental::filesystem::v1::__cxx11::path const&, std::experimental::filesystem::v1::__cxx11::path const&) (/mnt/c/work/programming/mdtex/build_linux/mdtex+0x7277b)
#5 0x7f00d84788bf in converter::operator()(std::experimental::filesystem::v1::__cxx11::path) (/mnt/c/work/programming/mdtex/build_linux/mdtex+0x788bf)
#6 0x7f00d8445b0b in main (/mnt/c/work/programming/mdtex/build_linux/mdtex+0x45b0b)
#7 0x7f00d6a51b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
SUMMARY: AddressSanitizer: heap-buffer-overflow (/mnt/c/work/programming/mdtex/build_linux/mdtex+0xb0935) in operator<<(std::ostream&, token const&)
Shadow bytes around the buggy address:
0x0c627ffff720: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c627ffff730: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c627ffff740: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c627ffff750: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c627ffff760: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c627ffff770: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00[fa]
0x0c627ffff780: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c627ffff790: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c627ffff7a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c627ffff7b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c627ffff7c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
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
==222==ABORTING