realm_emoji: Don't accept animated realm emoji with unequal dimensions.

Fixes: #3654.
This commit is contained in:
Harshit Bansal 2017-08-04 14:16:42 +00:00 committed by Tim Abbott
parent 4321f1f2b4
commit 5a5072730c
1 changed files with 4 additions and 1 deletions

View File

@ -107,7 +107,10 @@ def resize_emoji(image_data, size=DEFAULT_EMOJI_SIZE):
im = Image.open(io.BytesIO(image_data))
image_format = im.format
if image_format == 'GIF' and im.is_animated:
if im.size[0] > size or im.size[1] > size:
if im.size[0] != im.size[1]:
raise JsonableError(
_("Animated emoji must be have same width and height."))
elif im.size[0] > size:
raise JsonableError(
_("Animated emoji can't be larger than 64px in width or height."))
else: