Skip to content

Commit aee3073

Browse files
committed
Auto merge of #33934 - Byron:libsyntex-ring-buffer-size, r=pnkfelix
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.
2 parents 397cfae + 406378b commit aee3073

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libsyntax/print/pp.rs

+2-2
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)