vmg / sundown

Standards compliant, fast, secure markdown processing library in C
1.99k stars 385 forks source link

runtime error: null pointer passed as argument 2, which is declared to never be null #161

Open geeknik opened 6 years ago

geeknik commented 6 years ago

echo "=" | ./sundown triggers this undefined behavior with the latest commit when compiled with -fsanitize=undefined.

src/buffer.c:162:32: runtime error: null pointer passed as argument 2, which is declared to never be null
/usr/include/string.h:43:28: note: nonnull attribute specified here
    #0 0x51e8af in bufput /root/sundown/src/buffer.c:162:2
    #1 0x529ff6 in rndr_header /root/sundown/html/html.c:228:12
    #2 0x4f8139 in parse_paragraph /root/sundown/src/markdown.c:1532:4
    #3 0x4f8139 in parse_block /root/sundown/src/markdown.c:2243
    #4 0x4f01b5 in sd_markdown_render /root/sundown/src/markdown.c:2517:3
    #5 0x4e95a4 in main /root/sundown/examples/sundown.c:67:2
    #6 0x7f6d58a183f0 in __libc_start_main /build/glibc-mXZSwJ/glibc-2.24/csu/../csu/libc-start.c:291
    #7 0x419c49 in _start (/root/sundown/sundown+0x419c49)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/buffer.c:162:32