mirror of
https://github.com/openharmony/third_party_pcre2.git
synced 2026-07-01 10:05:26 -04:00
!104 merge wls_260310 into master
代码同步
Created-by: wu-liushuan
Commit-by: wu-liushuan
Merged-by: openharmony_ci
Description: ### 一、内容说明(相关的Issue)
### 二、建议测试周期和提测地址
建议测试完成时间:xxxx.xx.xx
投产上线时间:xxxx.xx.xx
提测地址:CI环境/压测环境
测试账号:
### 三、变更内容
* 3.1 关联PR列表
* 3.2 数据库和部署说明
1. 常规更新
2. 重启unicorn
3. 重启sidekiq
4. 迁移任务:是否有迁移任务,没有写 "无"
5. rake脚本:`bundle exec xxx RAILS_ENV = production`;没有写 "无"
* 3.4 其他技术优化内容(做了什么,变更了什么)
- 重构了 xxxx 代码
- xxxx 算法优化
* 3.5 废弃通知(什么字段、方法弃用?)
* 3.6 后向不兼容变更(是否有无法向后兼容的变更?)
### 四、研发自测点(自测哪些?冒烟用例全部自测?)
自测测试结论:
### 五、测试关注点(需要提醒QA重点关注的、可能会忽略的地方)
检查点:
| 需求名称 | 是否影响xx公共模块 | 是否需要xx功能 | 需求升级是否依赖其他子产品 |
|------|------------|----------|---------------|
| xxx | 否 | 需要 | 不需要 |
| | | | |
接口测试:
性能测试:
并发测试:
其他:
See merge request: openharmony/third_party_pcre2!104
This commit is contained in:
+24
-13
@@ -168,9 +168,10 @@ const pcre2_memctl *memctl = (gcontext != NULL) ?
|
||||
&gcontext->memctl : &PRIV(default_compile_context).memctl;
|
||||
|
||||
const uint8_t *src_bytes;
|
||||
pcre2_real_code *dst_re;
|
||||
pcre2_real_code *dst_re = NULL;
|
||||
uint8_t *tables;
|
||||
int32_t i, j;
|
||||
int32_t error;
|
||||
|
||||
/* Sanity checks. */
|
||||
|
||||
@@ -208,7 +209,10 @@ for (i = 0; i < number_of_codes; i++)
|
||||
memcpy(&blocksize, src_bytes + offsetof(pcre2_real_code, blocksize),
|
||||
sizeof(CODE_BLOCKSIZE_TYPE));
|
||||
if (blocksize <= sizeof(pcre2_real_code))
|
||||
return PCRE2_ERROR_BADSERIALIZEDDATA;
|
||||
{
|
||||
error = PCRE2_ERROR_BADSERIALIZEDDATA;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* The allocator provided by gcontext replaces the original one. */
|
||||
|
||||
@@ -216,13 +220,8 @@ for (i = 0; i < number_of_codes; i++)
|
||||
(pcre2_memctl *)gcontext);
|
||||
if (dst_re == NULL)
|
||||
{
|
||||
memctl->free(tables, memctl->memory_data);
|
||||
for (j = 0; j < i; j++)
|
||||
{
|
||||
memctl->free(codes[j], memctl->memory_data);
|
||||
codes[j] = NULL;
|
||||
}
|
||||
return PCRE2_ERROR_NOMEMORY;
|
||||
error = PCRE2_ERROR_NOMEMORY;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* The new allocator must be preserved. */
|
||||
@@ -232,10 +231,10 @@ for (i = 0; i < number_of_codes; i++)
|
||||
if (dst_re->magic_number != MAGIC_NUMBER ||
|
||||
dst_re->name_entry_size > MAX_NAME_SIZE + IMM2_SIZE + 1 ||
|
||||
dst_re->name_count > MAX_NAME_COUNT)
|
||||
{
|
||||
memctl->free(dst_re, memctl->memory_data);
|
||||
return PCRE2_ERROR_BADSERIALIZEDDATA;
|
||||
}
|
||||
{
|
||||
error = PCRE2_ERROR_BADSERIALIZEDDATA;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* At the moment only one table is supported. */
|
||||
|
||||
@@ -244,10 +243,22 @@ for (i = 0; i < number_of_codes; i++)
|
||||
dst_re->flags |= PCRE2_DEREF_TABLES;
|
||||
|
||||
codes[i] = dst_re;
|
||||
dst_re = NULL;
|
||||
src_bytes += blocksize;
|
||||
}
|
||||
|
||||
return number_of_codes;
|
||||
|
||||
cleanup:
|
||||
if (dst_re != NULL)
|
||||
memctl->free(dst_re, memctl->memory_data);
|
||||
memctl->free(tables, memctl->memory_data);
|
||||
for (j = 0; j < i; j++)
|
||||
{
|
||||
memctl->free(codes[j], memctl->memory_data);
|
||||
codes[j] = NULL;
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user