snudown
snudown copied to clipboard
Initialize struct with the correct number of members
b5ade1a697b48c7893fbbbde3d708ed9bb111f29 (#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?])
Hi @erikdesjardins. Thanks for this patch. I'll ping someone who can review.
@erikdesjardins are you depending on this code path, or just submitting this as cleanup?
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.
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 ^