Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
libbacktrace
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
libbacktrace
Commits
b3b57f9e
Commit
b3b57f9e
authored
Sep 08, 2020
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libbacktrace: correctly swap Mach-O 32-bit file offset
libbacktrace/ChangeLog: PR libbacktrace/96973 * macho.c (macho_add_fat): Correctly swap 32-bit file offset.
parent
886aef37
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
16 deletions
+19
-16
macho.c
macho.c
+19
-16
No files found.
macho.c
View file @
b3b57f9e
...
@@ -793,13 +793,24 @@ macho_add_fat (struct backtrace_state *state, const char *filename,
...
@@ -793,13 +793,24 @@ macho_add_fat (struct backtrace_state *state, const char *filename,
for
(
i
=
0
;
i
<
nfat_arch
;
++
i
)
for
(
i
=
0
;
i
<
nfat_arch
;
++
i
)
{
{
struct
macho_fat_arch_64
fat_arch
;
uint32_t
fcputype
;
uint32_t
fcputype
;
uint64_t
foffset
;
if
(
is_64
)
if
(
is_64
)
memcpy
(
&
fat_arch
,
{
struct
macho_fat_arch_64
fat_arch_64
;
memcpy
(
&
fat_arch_64
,
(
const
char
*
)
arch_view
.
data
+
i
*
arch_size
,
(
const
char
*
)
arch_view
.
data
+
i
*
arch_size
,
arch_size
);
arch_size
);
fcputype
=
fat_arch_64
.
cputype
;
foffset
=
fat_arch_64
.
offset
;
if
(
swapped
)
{
fcputype
=
__builtin_bswap32
(
fcputype
);
foffset
=
__builtin_bswap64
(
foffset
);
}
}
else
else
{
{
struct
macho_fat_arch
fat_arch_32
;
struct
macho_fat_arch
fat_arch_32
;
...
@@ -807,26 +818,18 @@ macho_add_fat (struct backtrace_state *state, const char *filename,
...
@@ -807,26 +818,18 @@ macho_add_fat (struct backtrace_state *state, const char *filename,
memcpy
(
&
fat_arch_32
,
memcpy
(
&
fat_arch_32
,
(
const
char
*
)
arch_view
.
data
+
i
*
arch_size
,
(
const
char
*
)
arch_view
.
data
+
i
*
arch_size
,
arch_size
);
arch_size
);
fat_arch
.
cputype
=
fat_arch_32
.
cputype
;
fcputype
=
fat_arch_32
.
cputype
;
fat_arch
.
cpusubtype
=
fat_arch_32
.
cpusubtype
;
foffset
=
(
uint64_t
)
fat_arch_32
.
offset
;
fat_arch
.
offset
=
(
uint64_t
)
fat_arch_32
.
offset
;
fat_arch
.
size
=
(
uint64_t
)
fat_arch_32
.
size
;
fat_arch
.
align
=
fat_arch_32
.
align
;
fat_arch
.
reserved
=
0
;
}
fcputype
=
fat_arch
.
cputype
;
if
(
swapped
)
if
(
swapped
)
{
fcputype
=
__builtin_bswap32
(
fcputype
);
fcputype
=
__builtin_bswap32
(
fcputype
);
foffset
=
(
uint64_t
)
__builtin_bswap32
((
uint32_t
)
foffset
);
}
}
if
(
fcputype
==
cputype
)
if
(
fcputype
==
cputype
)
{
{
uint64_t
foffset
;
/* FIXME: What about cpusubtype? */
/* FIXME: What about cpusubtype? */
foffset
=
fat_arch
.
offset
;
if
(
swapped
)
foffset
=
__builtin_bswap64
(
foffset
);
backtrace_release_view
(
state
,
&
arch_view
,
error_callback
,
data
);
backtrace_release_view
(
state
,
&
arch_view
,
error_callback
,
data
);
return
macho_add
(
state
,
filename
,
descriptor
,
foffset
,
match_uuid
,
return
macho_add
(
state
,
filename
,
descriptor
,
foffset
,
match_uuid
,
base_address
,
skip_symtab
,
error_callback
,
data
,
base_address
,
skip_symtab
,
error_callback
,
data
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment