summaryrefslogtreecommitdiffstats
path: root/yql/essentials/udfs/common
diff options
context:
space:
mode:
authoratarasov5 <[email protected]>2025-05-06 15:01:42 +0300
committeratarasov5 <[email protected]>2025-05-06 15:16:42 +0300
commit0ba803a734b1c0a6c0f79beff16668302c34f3d1 (patch)
tree0d86da8eb095d8492ab8ba33bd8f193e206ad4d4 /yql/essentials/udfs/common
parentca377fd4336db2e4e53c1cd32160cca95766d213 (diff)
YQL-19767: Introduce MKQL allocator address sanitizing
Здесь поддержал только out of bounds access и use after free. Отложенное использование памяти и тд буду делать потом commit_hash:2a3fd472b626762ff7c8b7b0bc1285af50c511cf
Diffstat (limited to 'yql/essentials/udfs/common')
-rw-r--r--yql/essentials/udfs/common/datetime2/datetime_udf.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/yql/essentials/udfs/common/datetime2/datetime_udf.cpp b/yql/essentials/udfs/common/datetime2/datetime_udf.cpp
index c159f63d5e5..35f0af4150f 100644
--- a/yql/essentials/udfs/common/datetime2/datetime_udf.cpp
+++ b/yql/essentials/udfs/common/datetime2/datetime_udf.cpp
@@ -3183,14 +3183,37 @@ private:
}
SetYear<TMResourceName>(result, year);
} else {
- static constexpr size_t size = 6;
i64 year = 0LL;
i64 negative = 1LL;
+ if (limit == 0) {
+ // Year must take at least 1 byte.
+ return false;
+ }
if (*it == '-') {
negative = -1LL;
it++;
+ limit--;
}
- if (!ParseNDigits<size, true>::Do(it, year) || !ValidateYear<TM64ResourceName>(negative * year)) {
+ auto parseDigits = [&]() {
+ switch (limit) {
+ case 0:
+ // Year number must take at least 1 byte.
+ return false;
+ case 1:
+ return ParseNDigits<1, true>::Do(it, year);
+ case 2:
+ return ParseNDigits<2, true>::Do(it, year);
+ case 3:
+ return ParseNDigits<3, true>::Do(it, year);
+ case 4:
+ return ParseNDigits<4, true>::Do(it, year);
+ case 5:
+ return ParseNDigits<5, true>::Do(it, year);
+ default:
+ return ParseNDigits<6, true>::Do(it, year);
+ }
+ };
+ if (!parseDigits() || !ValidateYear<TM64ResourceName>(negative * year)) {
return false;
}
SetYear<TM64ResourceName>(result, negative * year);