diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-05-23 19:32:18 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-05-25 01:18:11 -0700 |
| commit | a96067077a7536f80e131deaf3355c30ba8f3bff (patch) | |
| tree | d143bd14b17486e80e08eaf058f7823145ea97df | |
| parent | 316ef79dc2726a688373f86c5201d14db32684d9 (diff) | |
| download | rust-a96067077a7536f80e131deaf3355c30ba8f3bff.tar.gz rust-a96067077a7536f80e131deaf3355c30ba8f3bff.zip | |
rustdoc: Prevent a segfault when using markdown
The field passed from markdown could sometimes be null, and it wasn't properly handled.
| -rw-r--r-- | src/librustdoc/html/markdown.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index 7b8514ab38f..f49b7f3e989 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -144,6 +144,8 @@ pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result { extern fn block(ob: *mut hoedown_buffer, text: *hoedown_buffer, lang: *hoedown_buffer, opaque: *mut libc::c_void) { unsafe { + if text.is_null() { return } + let opaque = opaque as *mut hoedown_html_renderer_state; let my_opaque: &MyOpaque = &*((*opaque).opaque as *MyOpaque); slice::raw::buf_as_slice((*text).data, (*text).size as uint, |text| { |
