[PATCH] src: fix DEREF_OF_NULL.RET.STAT in unstrip.c

2025-02-13 Thread Anton Moryakov
b_finalize. - If symstrdata is NULL, the program exits with an error. Triggers found by static analyzer Svace. Signed-off-by: Anton Moryakov --- src/unstrip.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/unstrip.c b/src/unstrip.c index d70053de..35c04700 100644 --- a/src/unstrip.c

[PATCH] src: fix DEREF_OF_NULL.RET.STAT in readelf.c in

2025-02-13 Thread Anton Moryakov
yzer Svace. Signed-off-by: Anton Moryakov --- src/readelf.c | 5 + 1 file changed, 5 insertions(+) diff --git a/src/readelf.c b/src/readelf.c index 6526db07..3bdfb391 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -12440,6 +12440,11 @@ handle_core_item (Elf *core, const Ebl_Core_Item *item,

[PATCH] src: fix DEREF_OF_NULL.RET.STAT in readelf.c in

2025-02-13 Thread Anton Moryakov
elf_strptr call. - The check is placed before the first use of scnname to prevent dereferencing a NULL pointer. Triggers found by static analyzer Svace. Signed-off-by: Anton Moryakov --- src/readelf.c | 5 + 1 file changed, 5 insertions(+) diff --git a/src/readelf.c b/src/readelf.c inde

[PATCH] src: fix DEREF_OF_NULL.RET in readelf.c

2025-02-13 Thread Anton Moryakov
L, release resources with `elf_end` and skip the current iteration using `continue`. Triggers found by static analyzer Svace. Signed-off-by: Anton Moryakov --- src/readelf.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/readelf.c b/src/readelf.c index 6526db07..4c14f

[PATCH] scr: fix DEREF_OF_NULL.RET.STAT in ar.c

2025-02-13 Thread Anton Moryakov
usually checked for this function (4/5) Corrections explained: Added check if (arhdr == NULL) goto next; Triggers found by static analyzer Svace. Signed-off-by: Anton Moryakov --- src/ar.c | 12 1 file changed, 12 insertions(+) diff --git a/src/ar.c b/src/ar.c index 9ace28b9..4b901

[PATCH] libelf: fix DEREF_OF_NULL.RET in objdump.c

2025-02-04 Thread Anton Moryakov
r' returns NULL. This patch adds a check to ensure 'arhdr' is not NULL before using it. The fix ensures that the function safely handles cases where 'elf_getarhdr' fails, avoiding potential crashes. Triggers found by static analyzer Svace. Signed-off-by: Anton Moryakov --

[PATCH] libelf: fix DEREF_OF_NULL.RET in objdump.c

2025-01-31 Thread Anton Moryakov
r' returns NULL. This patch adds a check to ensure 'arhdr' is not NULL before using it. The fix ensures that the function safely handles cases where 'elf_getarhdr' fails, avoiding potential crashes. Triggers found by static analyzer Svace. Signed-off-by: Anton Moryakov

[PATCH] libdwfl: fix DEREF_OF_NULL.EX in dwfl_segment_report_module.c

2025-01-31 Thread Anton Moryakov
ers found by static analyzer Svace. Signed-off-by: Anton Moryakov --- libdwfl/dwfl_segment_report_module.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libdwfl/dwfl_segment_report_module.c b/libdwfl/dwfl_segment_report_module.c index 32f44af8..565884f0 100644 --- a/

[PATCH] libdw: fix DEREF_AFTER_NULL.EX in dwarf_ranges.c

2025-01-31 Thread Anton Moryakov
leading to undefined behavior. This patch adds a check to ensure 'd' is not NULL before using it. The fix ensures that the function safely handles cases where section data is missing, avoiding potential crashes. Triggers found by static analyzer Svace. Signed-off-by: Anton Moryakov ---

[PATCH] src: fix DEREF_AFTER_NULL.EX in elflint.c

2025-01-31 Thread Anton Moryakov
pointer, leading to undefined behavior. This patch adds a check to ensure suffix is not NULL before using it in stpcpy. The fix ensures that new_suffix is properly initialized even when suffix is NULL, avoiding potential crashes. Triggers found by static analyzer Svace. Signed-off-by: Anton Moryakov

[PATCH] FIX #74: DEREF_OF_NULL.RET.STAT in ar.c

2024-11-06 Thread Anton Moryakov
eck. This fix adds a NULL check before using arhdr, preventing a potential null dereference. This check ensures that the code safely handles cases when elf_getarhdr returns NULL, avoiding unexpected crashes. Found by RASU JSC. Signed-off-by: Anton Moryakov --- elfutils/src/ar.c | 6

[PATCH] FIX #90: STRING_OVERFLOW in sparc_attrs.c

2024-11-06 Thread Anton Moryakov
ill assert that the buffer is large enough to hold all possible values, without changing the rest of the logic. Found by RASY JSC signed-off-by: Anton Moryakov diff --git a/elfutils/backends/sparc_attrs.c b/elfutils/backends/sparc_attrs.c index 974e8fb..8cbf8cb 100644 --- a/elfutils/backends/spa

[PATCH] Обновить patches/0001-sparc_attrs.c-Prevent-buffer-overflow-in-sparc_check.patch

2024-11-05 Thread Anton Moryakov
fer-overflow-in-sparc_check.patch @@ -14,13 +14,13 @@ Found by RASU JSC. Signed-off-by: Anton Moryakov --- - elfutils/backends/sparc_attrs.c | 11 --- +backends/sparc_attrs.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) -diff --git a/elfutils/backends/sparc_attrs

[PATCH] sparc_attrs.c: Prevent buffer overflow in sparc_check_object_attribute

2024-11-05 Thread Anton Moryakov
beyond the allocated memory. Remaining space update: remaining_size is updated after each entry to ensure that row additions do not cause overflow. Found by RASU JSC. Signed-off-by: Anton Moryakov --- elfutils/backends/sparc_attrs.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-)

[PATCH] Fix potential handle leak by ensuring dlclose is always called on debuginfod_so

2024-11-01 Thread Anton Moryakov
function 'dlopen' and lost at debuginfod-client.c:129. In __libdwfl_debuginfod_init, added dlclose(debuginfod_so) after symbol loading, ensuring that the handle is released whether symbols are successfully loaded or not. This prevents potential handle leak reported by static analysis.

[PATCH] debuginfod-client.c: add dlclose call to prevent resource leak

2024-11-01 Thread Anton Moryakov
Previously, the handle debuginfod_so created by dlopen was not closed in all cases, leading to a potential resource leak. This commit adds an additional dlclose call to ensure that the handle is always properly released, whether the symbols are successfully loaded or not. Found by RASU JSC. Si