GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — diff: `-t --tabsize=<huge>` aborts in `do_expand_tabs` · Issue #286 · uutils/diffutils Open Description
$ printf '\tx\n' > a; printf 'y\n' > b $ diff -t --tabsize=18446744073709551615 a b > /dev/null Aborted (core dumped) $ echo $? 134 The threshold is the allocator, not a parse guard — the request scales directly $ diff -t --tabsize=1000000000 a b # 1e9 -> exit 1, diffs normally $ diff -t --tabsize=4611686018427387904 a b # 2^62 memory allocation of 4611686018427387905 bytes failed -> exit 134 $ diff -t --tabsize=9223372036854775807 a b # isize::MAX -> exit 134 A tab in the input is required — Root cause
pub fn do_expand_tabs(line: &[u8], tabsize: usize) -> Vec<u8> { let tab = b'\t'; let ntabs = line.iter().filter(|c| **c == tab).count(); if ntabs == 0 { return line.to_vec(); } let mut result = Vec::with_capacity(line.len() + ntabs * (tabsize - 1)); // :20 let mut offset = 0; let mut iter = line.split(|c| *c == tab).peekable(); while let Some(chunk) = iter.next() { ... if iter.peek().is_some() { result.resize(result.len() + tabsize - offset % tabsize, b' '); // :31
The same function aborts at a second site, # :20 — capacity overflow (tabsize = 2^63) $ diffutils diff -t --tabsize=9223372036854775808 a b thread 'main' panicked at library/alloc/src/raw_vec/mod.rs:...: capacity overflow $ echo $? 134 # :31 — allocation abort (tabsize = u64::MAX) $ printf '\tx\n' > a; printf 'y\n' > b $ diffutils diff -t --tabsize=18446744073709551615 a b thread 'main' panicked at library/alloc/src/raw_vec/mod.rs:28:5: $ echo $? 134 ActivityMetadataMetadataAssigneesLabelsNo labels TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |