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.
This commit is contained in:
bors 2016-05-29 03:02:46 -07:00
commit aee3073bd9
1 changed files with 2 additions and 2 deletions

View File

@ -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];