about summary refs log tree commit diff
path: root/src/libsyntax/print
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2016-05-28 17:29:59 +0200
committerSebastian Thiel <byronimo@gmail.com>2016-05-28 21:29:14 +0200
commit406378b6bb4a60f379cc713205fec5a8c4360c63 (patch)
tree544fbeaa2a9a9052e275e4397f4c2060b3e9e255 /src/libsyntax/print
parent3c795e08d6f4a532f12f3f8e1837db5e0647f8b0 (diff)
downloadrust-406378b6bb4a60f379cc713205fec5a8c4360c63.tar.gz
rust-406378b6bb4a60f379cc713205fec5a8c4360c63.zip
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/print')
-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];