With uncompress=True, crashes parent process (crash, not exception)
I've found that the combination of from_buffer and uncompress=True can crash the library. I suspect, but am unsure, that this stems from wrong usage of file_buffer.
My system is Ubuntu 16.04, also experienced this with Ubuntu 12.04; Python is 2.7.
Reproduce (edited re @ahupp ):
You need a zipped file, I use a 'docx' -- pretty much any docx would do.
Then run:
magic.Magic(mime=True, uncompress=True).from_buffer(open("filename.docx").read())
This crashes my Python.
I'm not able to reproduce this:
>>> import magic
>>> magic.Magic(uncompress=True, mime=True).from_file('test.docx')
'text/xml'
>>> magic.Magic(uncompress=True, mime=True).from_buffer(open('test.docx').read(1024))
'text/xml'
It wasn't clear if you meant from_buffer or from_file, the description says the former but the example says latter. This is with libmagic 5.35 and python-magic 0.4.15.
16.04 has libmagic 5.25, possibly there's a bugfix between .25 and .35.
I can repro with 5.25, but not 5.30.
And it only happens with from_buffer, not from_file.
It happens with the magic distributions python bindings as well. I've reported the bug to them:
https://bugs.astron.com/view.php?id=125
libmagic bug, closing.