Skip to content

Commit 406378b

Browse files
committed
Prevent overflows by increasing ring buffer size
Please note that this change is just done to prevent issues as currently seen by syntex_syntax in future. See serde-deprecated/syntex#47 for details. As shown in serde-deprecated/syntex#33, complex code can easily overflow the ring-buffer and cause an assertion error.
1 parent 3c795e0 commit 406378b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libsyntax/print/pp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,9 @@ pub struct PrintStackElem {
159159
const SIZE_INFINITY: isize = 0xffff;
160160

161161
pub fn mk_printer<'a>(out: Box<io::Write+'a>, linewidth: usize) -> Printer<'a> {
162-
// Yes 3, it makes the ring buffers big enough to never
162+
// Yes 55, it makes the ring buffers big enough to never
163163
// fall behind.
164-
let n: usize = 3 * linewidth;
164+
let n: usize = 55 * linewidth;
165165
debug!("mk_printer {}", linewidth);
166166
let token = vec![Token::Eof; n];
167167
let size = vec![0; n];

0 commit comments

Comments
 (0)