5 Star 0 Fork 13

OpenCloudOS Stream/binutils

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
fixed-CVE-2024-53589.patch 2.65 KB
一键复制 编辑 原始数据 按行查看 历史
jeremiazhao 提交于 2024-12-09 14:56 . fixed CVE-2024-53589
From e0323071916878e0634a6e24d8250e4faff67e88 Mon Sep 17 00:00:00 2001
From: Alan Modra <[email protected]>
Date: Mon, 11 Nov 2024 10:24:09 +1030
Subject: [PATCH] Re: tekhex object file output fixes
Commit 8b5a212495 supported *ABS* symbols by allowing "section" to be
bfd_abs_section, but bfd_abs_section needs to be treated specially.
In particular, bfd_get_next_section_by_name (.., bfd_abs_section_ptr)
is invalid.
PR 32347
* tekhex.c (first_phase): Guard against modification of
_bfd_std_section[] entries.
---
bfd/tekhex.c | 38 ++++++++++++++++++++------------------
1 file changed, 20 insertions(+), 18 deletions(-)
diff --git a/bfd/tekhex.c b/bfd/tekhex.c
index aea2ebb23df..b305c1f96f1 100644
--- a/bfd/tekhex.c
+++ b/bfd/tekhex.c
@@ -361,6 +361,7 @@ first_phase (bfd *abfd, int type, char *src, char * src_end)
{
asection *section, *alt_section;
unsigned int len;
+ bfd_vma addr;
bfd_vma val;
char sym[17]; /* A symbol can only be 16chars long. */
@@ -368,20 +369,16 @@ first_phase (bfd *abfd, int type, char *src, char * src_end)
{
case '6':
/* Data record - read it and store it. */
- {
- bfd_vma addr;
-
- if (!getvalue (&src, &addr, src_end))
- return false;
-
- while (*src && src < src_end - 1)
- {
- insert_byte (abfd, HEX (src), addr);
- src += 2;
- addr++;
- }
- return true;
- }
+ if (!getvalue (&src, &addr, src_end))
+ return false;
+
+ while (*src && src < src_end - 1)
+ {
+ insert_byte (abfd, HEX (src), addr);
+ src += 2;
+ addr++;
+ }
+ return true;
case '3':
/* Symbol record, read the segment. */
@@ -406,13 +403,16 @@ first_phase (bfd *abfd, int type, char *src, char * src_end)
{
case '1': /* Section range. */
src++;
- if (!getvalue (&src, &section->vma, src_end))
+ if (!getvalue (&src, &addr, src_end))
return false;
if (!getvalue (&src, &val, src_end))
return false;
- if (val < section->vma)
- val = section->vma;
- section->size = val - section->vma;
+ if (bfd_is_const_section (section))
+ break;
+ section->vma = addr;
+ if (val < addr)
+ val = addr;
+ section->size = val - addr;
/* PR 17512: file: objdump-s-endless-loop.tekhex.
Check for overlarge section sizes. */
if (section->size & 0x80000000)
@@ -455,6 +455,8 @@ first_phase (bfd *abfd, int type, char *src, char * src_end)
new_symbol->symbol.flags = BSF_LOCAL;
if (stype == '2' || stype == '6')
new_symbol->symbol.section = bfd_abs_section_ptr;
+ else if (bfd_is_const_section (section))
+ ;
else if (stype == '3' || stype == '7')
{
if ((section->flags & SEC_DATA) == 0)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/opencloudos-stream/binutils.git
[email protected]:opencloudos-stream/binutils.git
opencloudos-stream
binutils
binutils
master

搜索帮助