Project

General

Profile

Actions

Bug #17794

closed

addr2line.c can free(3) an invalid pointer without zlib

Added by xtkoba (Tee KOBAYASHI) 6 months ago. Updated about 1 month ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:103390]

Description

When built without zlib (./configure ac_cv_lib_z_uncompress=no), ruby aborts immediately after C level backtrace information is printed.

$ ruby -e 'Process.kill :SEGV, $$'
-e:1: [BUG] Segmentation fault at 0x000003e8000052ac
(...snip...)
-- C level backtrace information -------------------------------------------
/var/tmp/build.debug/x86_64-linux-gcc/lib/libruby.so.3.1(0x7f8abe871147) [0x7f8abe871147]
[0x7f8abe871179]
(...snip...)
[0x7f8abe65b5fa]
/var/tmp/build.debug/x86_64-linux-gcc/bin/ruby(main+0x7f) [0x55d1e2fd1234] ../main.c:47
free(): invalid pointer
Aborted

This happens because at addr2line.c:2344 s->ptr can be an invalid pointer.

A patch is attached for a workaround that makes s->ptr either valid or NULL.


Files

ruby-addr2line-free-invalid-pointer.patch (490 Bytes) ruby-addr2line-free-invalid-pointer.patch xtkoba (Tee KOBAYASHI), 04/12/2021 04:20 AM

Related issues

Related to Ruby master - Bug #17991: [TEST, CRASH] TestBugReporter#test_bug_reporter_add ClosedActions
Actions #2

Updated by jeremyevans0 (Jeremy Evans) 4 months ago

  • Related to Bug #17991: [TEST, CRASH] TestBugReporter#test_bug_reporter_add added
Actions #3

Updated by xtkoba (Tee KOBAYASHI) 4 months ago

  • Status changed from Open to Closed

Applied in changeset git|d795f494a89e0d9498dfedc54b8a98acc2bc4d7b.


Avoid free(3)ing invalid pointer

Fixes [Bug #17794]

Actions #4

Updated by nagachika (Tomoyuki Chikanaga) about 1 month ago

  • Backport changed from 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN to 2.6: UNKNOWN, 2.7: REQUIRED, 3.0: REQUIRED

Updated by nagachika (Tomoyuki Chikanaga) about 1 month ago

  • Backport changed from 2.6: UNKNOWN, 2.7: REQUIRED, 3.0: REQUIRED to 2.6: UNKNOWN, 2.7: REQUIRED, 3.0: DONE

ruby_3_0 8e4ed4ed00e8346029953c14dd414a996e37a437 merged revision(s) d795f494a89e0d9498dfedc54b8a98acc2bc4d7b.

Actions

Also available in: Atom PDF