From c52d9af6656ef27f59b10d9a351673ff338eb2f1 Mon Sep 17 00:00:00 2001 From: levlam Date: Tue, 30 Jun 2026 13:43:22 +0300 Subject: Improve inputPageBlockMap checks. --- td/generate/scheme/td_api.tl | 8 ++++---- td/telegram/WebPageBlock.cpp | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 8a172517a..c2b0ddb57 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -5915,11 +5915,11 @@ inputPageBlockTable caption:RichText cells:vector> is //@is_open True, if the block is open by default inputPageBlockDetails header:RichText blocks:vector is_open:Bool = InputPageBlock; -//@description A map +//@description A map. The map's width and height must not exceed 10000 in total. Width and height ratio must be at most 20 //@location Location of the map center -//@zoom Map zoom level -//@width Map width -//@height Map height +//@zoom Map zoom level; 0-24 +//@width Map width; 0-10000 +//@height Map height; 0-10000 //@caption Block caption inputPageBlockMap location:location zoom:int32 width:int32 height:int32 caption:pageBlockCaption = InputPageBlock; diff --git a/td/telegram/WebPageBlock.cpp b/td/telegram/WebPageBlock.cpp index 36ba23f3d..8f34e57a5 100644 --- a/td/telegram/WebPageBlock.cpp +++ b/td/telegram/WebPageBlock.cpp @@ -5187,9 +5187,10 @@ Result>> get_web_page_blocks( if (location.empty()) { return Status::Error(400, "Invalid location specified"); } - if (block->zoom_ < 0 || block->zoom_ > 25 || block->width_ < 0 || block->width_ >= 65536 || - block->height_ < 0 || block->height_ >= 65536) { - return Status::Error(400, "Invalid location parameters specified"); + if (block->zoom_ < 0 || block->zoom_ >= 25 || block->width_ < 0 || block->width_ > 10000 || + block->height_ < 0 || block->height_ > 10000 || block->width_ + block->height_ > 10000 || + block->width_ > block->height_ * 20 || block->height_ > block->width_ * 20) { + return Status::Error(400, "Invalid map properties specified"); } TRY_RESULT(caption, WebPageBlockCaption::get_web_page_block_caption(td, std::move(block->caption_))); result.push_back(td::make_unique( -- cgit v1.2.3