File load magic misfeature and workaround

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I noticed while writing a file loader for Cineon files (anyone waiting
for this?) an annoying misfeature of the file magic detection. I was
testing for a long value in hex with the top bit set. Unfortunately,
the value to check is loaded into a (signed) int variable, and strtol()
fails because the value overflows, and so the magic number is not
detected. (In fact, the file contents are compared with 0x7FFFFFFF.)
I looked at the code, but didn't change anything because it also allows
comparisons on the magic number, so fiddling with the signedness might
not be a good idea.

The easy workaround is to search for a four-byte string value instead.

-- 
David Hodson  --  hodsond@xxxxxxx  --  this night wounds time


[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux