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

index out of range panic in isReference #173

Closed
ghost opened this issue Jun 3, 2015 · 0 comments
Closed

index out of range panic in isReference #173

ghost opened this issue Jun 3, 2015 · 0 comments

Comments

@ghost
Copy link

ghost commented Jun 3, 2015

The below program panics:

package main

import "github.com/russross/blackfriday"

func main() {
    renderer := blackfriday.HtmlRenderer(blackfriday.HTML_USE_XHTML, "", "")
    blackfriday.Markdown([]byte("   ["), renderer,
        blackfriday.EXTENSION_TABLES|
            blackfriday.EXTENSION_AUTOLINK|
            blackfriday.EXTENSION_FOOTNOTES|
            blackfriday.EXTENSION_TITLEBLOCK|
            blackfriday.EXTENSION_HEADER_IDS|
            blackfriday.EXTENSION_FENCED_CODE|
            blackfriday.EXTENSION_SPACE_HEADERS|
            blackfriday.EXTENSION_STRIKETHROUGH|
            blackfriday.EXTENSION_TAB_SIZE_EIGHT|
            blackfriday.EXTENSION_AUTO_HEADER_IDS|
            blackfriday.EXTENSION_LAX_HTML_BLOCKS|
            blackfriday.EXTENSION_HARD_LINE_BREAK|
            blackfriday.EXTENSION_NO_INTRA_EMPHASIS|
            blackfriday.EXTENSION_BACKSLASH_LINE_BREAK|
            blackfriday.EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK,
    )
}
tw4452852 added a commit to tw4452852/blackfriday that referenced this issue Jun 8, 2015
Add checking before accessing the input data.

Fix russross#172 and russross#173 issues.

Signed-off-by: Tw <tw19881113@gmail.com>
@rtfb rtfb closed this as completed Jun 8, 2015
rtfb added a commit that referenced this issue Apr 21, 2016
Fix regession: index out of range panic in reference link (#172, #173)
dmitshur added a commit that referenced this issue Jul 15, 2016
These will be helpful for catching regressions or changes in behavior
to edge cases such as empty input, or specifically crafted inputs that
may cause panics, etc.

Move test for issue #172 there since it's a document-level test, not an
inline one.

Add test for issue #173.

Make some things more consistent.

Don't use a named receiver in methods that don't use it. This makes the
code more readable since one can more quickly tell the inputs to the
method.
rtfb added a commit that referenced this issue Feb 12, 2017
The check was introduced with d28de22, when fixing #172 and #173.
Then I removed it with bcd6dd8 when fixing #180
And then it was reintroduced with 232d06c when fixing regression.

It seems that the check can be removed again. All these cases now have
tests (including the one from 69f51af, which seems to have landed to v1
only, copying it here) and they all pass.
@rtfb rtfb mentioned this issue Feb 12, 2017
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

1 participant