You could use file(1) magic to check if a file is indeed a compressed file before trying to uncompress.
... but you should remember that this creates a TOCTTOU vulnerability. Also, magic checks check only for magic numbers, not for validity.
Alexander
In reply to Re^2: How do you get IO::Uncompress::Gunzip to error if the input file isn't a GZ file?
by afoken
in thread How do you get IO::Uncompress::Gunzip to error if the input file isn't a GZ file?
by sectokia
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |