Skip to content

Commit a960670

Browse files
committed
rustdoc: Prevent a segfault when using markdown
The field passed from markdown could sometimes be null, and it wasn't properly handled.
1 parent 316ef79 commit a960670

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/librustdoc/html/markdown.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result {
144144
extern fn block(ob: *mut hoedown_buffer, text: *hoedown_buffer,
145145
lang: *hoedown_buffer, opaque: *mut libc::c_void) {
146146
unsafe {
147+
if text.is_null() { return }
148+
147149
let opaque = opaque as *mut hoedown_html_renderer_state;
148150
let my_opaque: &MyOpaque = &*((*opaque).opaque as *MyOpaque);
149151
slice::raw::buf_as_slice((*text).data, (*text).size as uint, |text| {

0 commit comments

Comments
 (0)