From 583918b4d2d2dd2b37205918d8707b5b6111d3d1 Mon Sep 17 00:00:00 2001 From: Ross Lagerwall Date: Tue, 20 Oct 2015 11:52:20 +0100 Subject: [PATCH] Fail if the function is too small to patch --- create-diff-object.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/create-diff-object.c b/create-diff-object.c index 5b8fb09..5064881 100644 --- a/create-diff-object.c +++ b/create-diff-object.c @@ -152,6 +152,8 @@ struct xsplice_elf { int fd; }; +#define PATCH_INSN_SIZE 5 + struct xsplice_patch_func { unsigned long new_addr; unsigned long new_size; @@ -1990,6 +1992,9 @@ void xsplice_create_patches_sections(struct xsplice_elf *kelf, log_debug("lookup for %s @ 0x%016lx len %lu\n", sym->name, result.value, result.size); + if (result.size < PATCH_INSN_SIZE) + ERROR("%s too small to patch", sym->name); + /* add entry in text section */ funcs[index].old_addr = result.value; funcs[index].old_size = result.size; -- 2.39.5