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

Initialize struct with the correct number of members #83

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

erikdesjardins
Copy link

b5ade1a (#78) added two members to this struct, but only one to this initializer.
This leads to undefined behaviour when rendering something like #/u/test, since the other callback functions are called through wrongly-typed function pointers.

(It's my understanding that reddit doesn't use Snudown to render the ToC, and hence doesn't test this code path, but I'm surprised that compiler warnings about this were disabled [or ignored?])

b5ade1a (reddit#78) added two members to this struct, but only one to this initializer.
This leads to undefined behaviour when rendering something like `#/u/test`, since the other callback functions are called through wrongly-typed function pointers.

(It's my understanding that reddit doesn't use Snudown to render the ToC, and hence doesn't test this code path, but I'm surprised that compiler warnings about this were disabled [or ignored?])
@brson
Copy link

brson commented Mar 29, 2018

Hi @erikdesjardins. Thanks for this patch. I'll ping someone who can review.

@brson
Copy link

brson commented Mar 29, 2018

@erikdesjardins are you depending on this code path, or just submitting this as cleanup?

@erikdesjardins
Copy link
Author

I do use this, but I already use a fork (where it's compiled to JS/wasm) so I don't depend on it being upstreamed.

@JordanMilne
Copy link
Contributor

Yeah, we don't use the ToC renderer, but I don't recall seeing any warnings about it when I last looked. Might be a clang / GCC thing, or maybe it'd changed since then? Def a bug though. @birakattack ^

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

Successfully merging this pull request may close these issues.

3 participants