From 5c6ad4c669b65d6e2bf74639d22aca6a6b103ade Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Tue, 7 Jul 2015 23:12:56 +0200 Subject: [PATCH] imgconverter: use more meaningful error for empty icon image (cherry picked from commit 6e69ce22348eb0082e8ac696570189105c14524f) --- core/imgconverter.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/imgconverter.py b/core/imgconverter.py index a371d0f..3873470 100755 --- a/core/imgconverter.py +++ b/core/imgconverter.py @@ -115,6 +115,8 @@ get_from_stream(), get_from_vm(), get_xdg_icon_from_vm(), get_through_dvm()''' maxhdrlen = imghdrlen(max_width, max_height) untrusted_header = stream.readline(maxhdrlen) + if len(untrusted_header) == 0: + raise ValueError('No icon received') if not re_imghdr.match(untrusted_header): raise ValueError('Image format violation') header = untrusted_header