about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-05-29 03:02:46 -0700
committerbors <bors@rust-lang.org>2016-05-29 03:02:46 -0700
commitaee3073bd9c02a0ae8ccf1f292ef36ae49ab10ac (patch)
tree3b7e10c95beedc166783fe9436ac8a7143926771 /src/libsyntax
parent397cfaec0ce28289b0ab04ed6f6c3ba6ee1042ea (diff)
parent406378b6bb4a60f379cc713205fec5a8c4360c63 (diff)
downloadrust-aee3073bd9c02a0ae8ccf1f292ef36ae49ab10ac.tar.gz
rust-aee3073bd9c02a0ae8ccf1f292ef36ae49ab10ac.zip
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 https://github.com/serde-rs/syntex/pull/47 for details.

As shown in https://github.com/serde-rs/syntex/issues/33,
complex code can easily overflow the ring-buffer and
cause an assertion error.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/print/pp.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs
index 4a92ad8ddb2..32b66da4d96 100644
--- a/src/libsyntax/print/pp.rs
+++ b/src/libsyntax/print/pp.rs
@@ -159,9 +159,9 @@ pub struct PrintStackElem {
 const SIZE_INFINITY: isize = 0xffff;
 
 pub fn mk_printer<'a>(out: Box<io::Write+'a>, linewidth: usize) -> Printer<'a> {
-    // Yes 3, it makes the ring buffers big enough to never
+    // Yes 55, it makes the ring buffers big enough to never
     // fall behind.
-    let n: usize = 3 * linewidth;
+    let n: usize = 55 * linewidth;
     debug!("mk_printer {}", linewidth);
     let token = vec![Token::Eof; n];
     let size = vec![0; n];