Security of Java takes a dangerous turn for the worse, experts say (ars technica)
Security of Java takes a dangerous turn for the worse, experts say (ars technica)
Posted Sep 14, 2013 10:25 UTC (Sat) by alankila (guest, #47141)In reply to: Security of Java takes a dangerous turn for the worse, experts say (ars technica) by smurf
Parent article: Security of Java takes a dangerous turn for the worse, experts say (ars technica)
>>> import subprocess, gzip; subprocess.Popen(args="/bin/ls", stdout=gzip.GzipFile("testfile", "wb")).communicate()
(None, None)
The intent of code is hopefully clear. I should have a gzipped output 'testfile' of the command of /bin/ls. Unfortunately to me, Popen() calls fileno() on GzipFile and steals the handle from it, and writes uncompressed data bracketed by gzip gunk for 0-byte file. So, GzipFile shouldn't implement fileno(), or someone shouldn't play fast and loose with Popen and should rather read from the stdout/stderr pipes during communicate() and use the correct abstraction of file.write to write when a file object is passed in.
At least java's abstractions generally work correctly...
