[前][次][番号順一覧][スレッド一覧]

ruby-changes:56472

From: Yusuke <ko1@a...>
Date: Sun, 14 Jul 2019 17:55:07 +0900 (JST)
Subject: [ruby-changes:56472] Yusuke Endoh: db1c30b37f (master): addr2line.c (main_exe_path): avoid SEGV when /proc is not available

https://git.ruby-lang.org/ruby.git/commit/?id=db1c30b37f

From db1c30b37fb0a837724cf5813e8684edc2639222 Mon Sep 17 00:00:00 2001
From: Yusuke Endoh <mame@r...>
Date: Sun, 14 Jul 2019 17:53:45 +0900
Subject: addr2line.c (main_exe_path): avoid SEGV when /proc is not available

readlink would return -1 if /proc is not mounted.
Coverity Scan found this issue.

diff --git a/addr2line.c b/addr2line.c
index 1871a52..45cae6a 100644
--- a/addr2line.c
+++ b/addr2line.c
@@ -2050,6 +2050,7 @@ main_exe_path(void) https://github.com/ruby/ruby/blob/trunk/addr2line.c#L2050
 {
 # define PROC_SELF_EXE "/proc/self/exe"
     ssize_t len = readlink(PROC_SELF_EXE, binary_filename, PATH_MAX);
+    if (len < 0) return 0;
     binary_filename[len] = 0;
     return len;
 }
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]