Skip to content

Commit 8570e42

Browse files
Backport #86171 to 25.8: Fix use-of-unitialized-value and crash introduced in #85063
1 parent 84760b0 commit 8570e42

File tree

4 files changed

+5
-2
lines changed

4 files changed

+5
-2
lines changed

src/Functions/ReplaceStringImpl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ struct ReplaceStringImpl
354354
res_data.assign(haystack_data.begin(), haystack_data.end());
355355
res_offsets.resize(input_rows_count);
356356
for (size_t i = 1; i <= input_rows_count; ++i)
357-
res_offsets[i] = i * n;
357+
res_offsets[i - 1] = i * n;
358358
return;
359359
}
360360

src/Functions/URL/domain.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ inline std::string_view getURLHost(const char * data, size_t size)
172172
Pos pos = data;
173173
Pos end = data + size;
174174

175-
if (*pos == '/' && *(pos + 1) == '/')
175+
if (size >= 2 && *pos == '/' && *(pos + 1) == '/')
176176
{
177177
pos += 2;
178178
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
a
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
SELECT replace(materialize(toFixedString('a', 1)), '', '');
2+

0 commit comments

Comments
 (0)