Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to cmark 0.30.2 #278

Open
apps4everyone opened this issue Dec 15, 2021 · 6 comments
Open

Update to cmark 0.30.2 #278

apps4everyone opened this issue Dec 15, 2021 · 6 comments

Comments

@apps4everyone
Copy link

Update to cmark 0.30.2

@Parth
Copy link

Parth commented Mar 9, 2022

@johnxnguyen we've run into a bug which is present on 0.29, but not present on 0.30:

If you try to render a single tick (`) on 0.30.2 with the following C code:

char *content = "`";
int opts = 0;

cmark_node *doc = cmark_parse_document(content, strlen(content), opts);
printf("%d, %d\n", doc->start_column, doc->end_column);
printf("%d, %d\n", doc->first_child->start_column, doc->first_child->end_column);
printf("%d, %d\n", doc->first_child->first_child->start_column, doc->first_child->first_child->end_column);

you get:

1, 1
1, 1
1, 1

as expected, but if you do so with 0.29 (Down's current version which is 3 years old) you get:

1, 1
1, 1
2, 2

which exceeds the document bounds and depending on what you're doing with the AST you'll experience crashes

@Parth
Copy link

Parth commented Mar 9, 2022

here is the tree visualized in the xcode debugger:
image

@Parth
Copy link

Parth commented Mar 9, 2022

if you need it here is what the debug visitor sees:

Document
    ↳ Paragraph
        ↳ Text - `

(which is fine)

@Parth
Copy link

Parth commented Mar 9, 2022

Here is a small C program you can use for testing:

bugqmark.zip

if you go into the cmark folder and checkout the most recent commit and regen the libs you'll find that the problem goes away and we're returned valid ranges.

@Parth
Copy link

Parth commented Mar 9, 2022

Thanks for lending a hand with the C code @steverusso

@Parth
Copy link

Parth commented Mar 9, 2022

I updated on my fork, and everything seems to be working fine, will report back as I explore more: https://github.com/Parth/Down

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants