aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorlevlam <levlam@telegram.org>2026-06-30 13:43:22 +0300
committerlevlam <levlam@telegram.org>2026-06-30 13:43:22 +0300
commitc52d9af6656ef27f59b10d9a351673ff338eb2f1 (patch)
treeeb163b2ae7d42db847640daf1997ea3c2027c3ad
parentce44f21aa4bb894cca381c47b4286f60e4f65280 (diff)
Improve inputPageBlockMap checks.
-rw-r--r--td/generate/scheme/td_api.tl8
-rw-r--r--td/telegram/WebPageBlock.cpp7
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<vector<pageBlockTableCell>> is
//@is_open True, if the block is open by default
inputPageBlockDetails header:RichText blocks:vector<InputPageBlock> 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<vector<unique_ptr<WebPageBlock>>> 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<WebPageBlockMap>(