mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
builtin: add sanity check on the number of returned frames by C.backtrace
This commit is contained in:
@@ -103,10 +103,14 @@ $if msvc {
|
||||
syminitok := C.SymInitialize( handle, 0, 1)
|
||||
if syminitok != 1 {
|
||||
eprintln('Failed getting process: Aborting backtrace.\n')
|
||||
return true
|
||||
return false
|
||||
}
|
||||
|
||||
frames := int(C.CaptureStackBackTrace(skipframes + 1, 100, backtraces, 0))
|
||||
if frames < 2 {
|
||||
eprintln('C.CaptureStackBackTrace returned less than 2 frames')
|
||||
return false
|
||||
}
|
||||
for i in 0..frames {
|
||||
frame_addr := backtraces[i]
|
||||
if C.SymFromAddr(handle, frame_addr, &offset, si) == 1 {
|
||||
|
||||
Reference in New Issue
Block a user