Weakened animated sticker parameters checks

This commit is contained in:
Ilya Laktyushin 2019-07-18 21:24:20 +02:00
parent eddb05b020
commit 9a662ab2df
2 changed files with 4 additions and 13 deletions

View File

@ -66,11 +66,7 @@ NSData * _Nullable TGGUnzipData(NSData *data, uint sizeLimit)
}
if (stream.total_out >= output.length) {
NSUInteger length = output.length + data.length / 2;
if (sizeLimit > 0 && length > sizeLimit) {
return nil;
}
output.length = length;
output.length = output.length + data.length / 2;
}
stream.next_out = (uint8_t *)output.mutableBytes + stream.total_out;
stream.avail_out = (uInt)(output.length - stream.total_out);
@ -79,6 +75,8 @@ NSData * _Nullable TGGUnzipData(NSData *data, uint sizeLimit)
if (inflateEnd(&stream) == Z_OK) {
if (status == Z_STREAM_END) {
output.length = stream.total_out;
} else if (sizeLimit > 0 && output.length > sizeLimit) {
return nil;
}
}
}

View File

@ -21,14 +21,7 @@
_frameCount = (int32_t)_animation->totalFrame();
_frameRate = (int32_t)_animation->frameRate();
size_t width = 0;
size_t height = 0;
_animation->size(width, height);
if (width != height || (width != 100 && width != 512)) {
return nil;
}
if ((_frameRate > 30 && _frameRate != 60) || _animation->duration() > 4.5) {
if ((_frameRate > 60) || _animation->duration() > 4.5) {
return nil;
}
}