warning about _unpack_asf_image

This commit is contained in:
Adrian Sampson 2013-01-29 21:59:28 -08:00
parent 70492ab67e
commit ce7a57d57a

View file

@ -148,9 +148,15 @@ def _safe_cast(out_type, val):
# Image coding for ASF/WMA.
def _unpack_asf_image(data):
"""Unpack image data from a WM/Picture tag.
"""Unpack image data from a WM/Picture tag. Return a tuple
containing the MIME type, the raw image data, a type indicator, and
the image's description.
This function is treated as "untrusted" and could throw all manner
of exceptions (out-of-bounds, etc.). We should clean this up
sometime so that the failure modes are well-defined.
"""
(type, size) = struct.unpack_from("<bi", data)
type, size = struct.unpack_from("<bi", data)
pos = 5
mime = ""
while data[pos:pos+2] != "\x00\x00":