Skip to content

Commit

Permalink
Auto merge of #33934 - Byron:libsyntex-ring-buffer-size, r=pnkfelix
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bors committed May 29, 2016
2 parents 397cfae + 406378b commit aee3073
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/libsyntax/print/pp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit aee3073

Please sign in to comment.