Post #1854994
2026-04-30 14:26 UTC
Running my tar parser on all the tar files in the Debian archive, to find cases I haven't handled yet. It's not done yet, but so far I've collected
2 num_read == sizeof s->buffer
3 symlink_size < LEN_LINK_TARGET
3243 unexpected character in octal
780 unhandled file type
17 unused tar header has data
8 value_len < sizeof s->filename
Basically, I've plastered a bunch of checks all over the code that are like assert(), but remain in Release code. All of these are hard errors so far, and I will need to add more checks and also make the parser less strict in places where it is overly so.
"num_read == sizeof s->buffer" means that the tar file is not a multiple of 512 bytes in size.
"symlink_size < LEN_LINK_TARGET" means that the link target field is used completely and not NUL terminated. That's probably legal, but I'm amazed someone is running into this. Also, I suspect there is an encoding for even longer symlinks.
"unexpected character in octal" seems to be mostly octal numbers that are right-justified in the field with spaces, which should be legal.
"unhandled file type" refers to the file type marker inside the archive -- I handle directories, files, symlinks and extension headers for the whole archive and for individual files. So that's a TODO item.
"unused tar header has data" happens when the first byte of the filename is NUL, but there are non-NUL bytes in that block. Need to investigate what these are.
"value_len < sizeof s->filename" means that there is a long file name with more than 255 bytes.
Getting the full statistics will take a while, and then I need to fix the program and re-run everything.
Replies (0)
No replies.