blackwinter / ruby-filemagic

Ruby bindings to the magic(4) library, revised.
https://blackwinter.github.iom/ruby-filemagic
146 stars 34 forks source link

Name use count (30) exceeded error with file on TIFF image #45

Open joseneto opened 1 year ago

joseneto commented 1 year ago

I getting this random error on jpeg file

FileMagic::FileMagicError
failed lookup: JPEG image data, Exif standard: [TIFF image data, little-endian, direntries=13, height=3072, manufacturer=Google, model=Pixel 7 Pro, orientation=upper-left, xresolution=189, yresolution=197, resolutionunit=2, software=HDR+ 1.0.479933560zd, datetime=2022:10:14 16:52:27, GPS-Data, width=4080] name use count (30) exceeded 

After some research looks like its happen with some linux distros, at least I can't reproduce on MAC. Looks like the solution is increase the name recursion level.

https://bugs.astron.com/view.php?id=152

file --parameter name=50 test.jpg

The magic_getparam() and magic_setparam() allow getting and setting various limits related to the magic library.

       Parameter                    Type      Default
       MAGIC_PARAM_INDIR_MAX        size_t    15
       MAGIC_PARAM_NAME_MAX         size_t    30
       MAGIC_PARAM_ELF_NOTES_MAX    size_t    256
       MAGIC_PARAM_ELF_PHNUM_MAX    size_t    128
       MAGIC_PARAM_ELF_SHNUM_MAX    size_t    32768
       MAGIC_PARAM_REGEX_MAX        size_t    8192
       MAGIC_PARAM_BYTES_MAX        size_t    1048576

I would like to know if this gem allow me pass any parameters?