From aa436cbcc75c07e2ba3506c0246ce764efb590b5 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Fri, 10 Jun 2022 16:52:57 +0800 Subject: [PATCH] tools: elf: don't get `raw_data` for no_copy sections The `xmas-elf` crate doesn't deal with `raw_data()` of sections that are `NO_COPY`. These sections may point to data that is outside of the file. In order to avoid hitting this assert, don't call `raw_data()` on sections that are marked `NO_COPY`. Signed-off-by: Sean Cross --- tools/src/elf.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tools/src/elf.rs b/tools/src/elf.rs index d14a4d36f..0deb13178 100644 --- a/tools/src/elf.rs +++ b/tools/src/elf.rs @@ -315,11 +315,13 @@ pub fn read_minielf>(filename: P) -> Result>(filename: P) -> Result