1 Star 0 Fork 5

Meredith/luajit

forked from src-anolis-os/luajit 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0050-Fix-memory-probing-allocator-to-check-for-valid-end-.patch 987 Bytes
一键复制 编辑 原始数据 按行查看 历史
xingwei-liu 提交于 2022-07-28 14:43 . init package version for an8.6
From 646148e747759f0af3b47f9bd287cedd7e174631 Mon Sep 17 00:00:00 2001
From: Mike Pall <mike>
Date: Thu, 13 Sep 2018 17:58:50 +0200
Subject: [PATCH 50/72] Fix memory probing allocator to check for valid end
address, too.
---
src/lj_alloc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/lj_alloc.c b/src/lj_alloc.c
index f3b6a54..33a2eb8 100644
--- a/src/lj_alloc.c
+++ b/src/lj_alloc.c
@@ -255,7 +255,8 @@ static void *mmap_probe(size_t size)
for (retry = 0; retry < LJ_ALLOC_MMAP_PROBE_MAX; retry++) {
void *p = mmap((void *)hint_addr, size, MMAP_PROT, MMAP_FLAGS_PROBE, -1, 0);
uintptr_t addr = (uintptr_t)p;
- if ((addr >> LJ_ALLOC_MBITS) == 0 && addr >= LJ_ALLOC_MMAP_PROBE_LOWER) {
+ if ((addr >> LJ_ALLOC_MBITS) == 0 && addr >= LJ_ALLOC_MMAP_PROBE_LOWER &&
+ ((addr + size) >> LJ_ALLOC_MBITS) == 0) {
/* We got a suitable address. Bump the hint address. */
hint_addr = addr + size;
errno = olderr;
--
2.20.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yueeranna/luajit.git
git@gitee.com:yueeranna/luajit.git
yueeranna
luajit
luajit
a8

搜索帮助

0d507c66 1850385 C8b1a773 1850385