代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/boost 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 1ff0ead837b32b9415dc840dfef6549e8754b98d Mon Sep 17 00:00:00 2001
From: Alexander Grund <Flamefire@users.noreply.github.com>
Date: Fri, 10 Dec 2021 17:53:01 +0100
Subject: [PATCH] Fix access to first element of empty vector
Trying to access tmp[0] causes a crash on Fedora when assertion on STL
are enabled.
/usr/include/c++/10/bits/stl_vector.h:1045: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) [with _Tp = unsigned char; _Alloc = std::allocator<unsigned char>; std::vector<_Tp, _Alloc>::reference = unsigned char&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]: Assertion '__builtin_expect(__n < this->size(), true)' failed.
Fix is to never have an empty vector as ICU sort keys include the NULL
terminator, hence we need at least `length + 1` bytes which means the
vector has at least 1 element: The NULL terminator
---
src/icu/collator.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libs/locale/src/icu/collator.cpp b/libs/locale/src/icu/collator.cpp
index 7f1ea6ae..79668aa6 100644
--- a/libs/locale/src/icu/collator.cpp
+++ b/libs/locale/src/icu/collator.cpp
@@ -91,9 +91,9 @@ namespace boost {
{
icu::UnicodeString str=cvt_.icu(b,e);
std::vector<uint8_t> tmp;
- tmp.resize(str.length());
+ tmp.resize(str.length() + 1u);
icu::Collator *collate = get_collator(level);
- int len = collate->getSortKey(str,&tmp[0],tmp.size());
+ const int len = collate->getSortKey(str,&tmp[0],tmp.size());
if(len > int(tmp.size())) {
tmp.resize(len);
collate->getSortKey(str,&tmp[0],tmp.size());
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。