vmg / sundown

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

Segmentation fault #64

Closed FSX closed 13 years ago

FSX commented 13 years ago

When running the example code (examples/sundown.c) a segmentation fault appears.

I'm not sure what kind of info to provide. Valgrind output, strace output, something else?

vmg commented 13 years ago

That's weird. Have you ensured you have a clean build?

Either way, a GDB backtrace would be perfect. Thanks in advance!

FSX commented 13 years ago

Here's a backtrace.

yui% gdb ./sundown                     
GNU gdb (GDB) 7.3
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/frank/Tmp/sundown/sundown...done.
(gdb) run markdown-test-01.md
Starting program: /home/frank/Tmp/sundown/sundown markdown-test-01.md

Program received signal SIGSEGV, Segmentation fault.
bufrelease (buf=0xffffffff) at src/buffer.c:253
253     if (--buf->ref == 0) {
(gdb) backtrace
#0  bufrelease (buf=0xffffffff) at src/buffer.c:253
#1  0x000000000040681c in sd_markdown_free (md=0x60ca90) at src/markdown.c:2349
#2  0x0000000000400c95 in main (argc=<optimized out>, argv=<optimized out>) at examples/sundown.c:68
(gdb) 
vmg commented 13 years ago

Can you tell me if this latest commit fixes the issue? Cannot run Valgrind on Lion, dangit.

FSX commented 13 years ago

That fixes it. Thanks.