imgconverter: use more meaningful error for empty icon image

(cherry picked from commit 6e69ce2234)
This commit is contained in:
Marek Marczykowski-Górecki 2015-07-07 23:12:56 +02:00
parent 6e4fa03459
commit 5c6ad4c669
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -115,6 +115,8 @@ get_from_stream(), get_from_vm(), get_xdg_icon_from_vm(), get_through_dvm()'''
maxhdrlen = imghdrlen(max_width, max_height) maxhdrlen = imghdrlen(max_width, max_height)
untrusted_header = stream.readline(maxhdrlen) untrusted_header = stream.readline(maxhdrlen)
if len(untrusted_header) == 0:
raise ValueError('No icon received')
if not re_imghdr.match(untrusted_header): if not re_imghdr.match(untrusted_header):
raise ValueError('Image format violation') raise ValueError('Image format violation')
header = untrusted_header header = untrusted_header