Hi, I ran into a PAX parsing issue with a symlink whose linkpath value contains a newline.
Example:
let mut exts = tar::PaxExtensions::new(b"16 linkpath=a\nb\n");
let ext = exts.next().unwrap().unwrap();
assert_eq!(ext.key(), Ok("linkpath"));
assert_eq!(ext.value_bytes(), b"a\nb");
I expected this to parse as one PAX record, because the record is length-prefixed. But currently PaxExtensions splits the whole buffer on \n first.
From what I understand, PAX records should be parsed by consuming the decimal length prefix first.
This came up through linkpath on a symlink, but I think the same issue could affect any PAX keyword whose value contains a newline.
Would a patch that changes PaxExtensions to walk the buffer by record length be acceptable? I'd like to try it.
Hi, I ran into a PAX parsing issue with a symlink whose
linkpathvalue contains a newline.Example:
I expected this to parse as one PAX record, because the record is length-prefixed. But currently PaxExtensions splits the whole buffer on \n first.
From what I understand, PAX records should be parsed by consuming the decimal length prefix first.
This came up through linkpath on a symlink, but I think the same issue could affect any PAX keyword whose value contains a newline.
Would a patch that changes PaxExtensions to walk the buffer by record length be acceptable? I'd like to try it.