Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
d19d9bb0
Commit
d19d9bb0
authored
Aug 26, 2013
by
take_cheeze
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix crash in 2nd call to vsnprintf
parent
596cd3f6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
src/backtrace.c
src/backtrace.c
+10
-5
No files found.
src/backtrace.c
View file @
d19d9bb0
...
...
@@ -32,7 +32,7 @@ get_backtrace_i(mrb_state *mrb, void *stream, int level, const char *format, ...
{
va_list
ap
;
mrb_value
ary
,
str
;
int
len
,
ai
;
int
ai
;
if
(
level
>
0
)
{
return
;
...
...
@@ -40,12 +40,17 @@ get_backtrace_i(mrb_state *mrb, void *stream, int level, const char *format, ...
ai
=
mrb_gc_arena_save
(
mrb
);
ary
=
mrb_obj_value
((
struct
RArray
*
)
stream
);
va_start
(
ap
,
format
);
len
=
vsnprintf
(
NULL
,
0
,
format
,
ap
);
str
=
mrb_str_new
(
mrb
,
0
,
len
);
vsnprintf
(
RSTRING_PTR
(
str
),
len
,
format
,
ap
);
mrb_ary_push
(
mrb
,
ary
,
str
);
str
=
mrb_str_new
(
mrb
,
0
,
vsnprintf
(
NULL
,
0
,
format
,
ap
)
+
1
);
va_end
(
ap
);
va_start
(
ap
,
format
);
vsnprintf
(
RSTRING_PTR
(
str
),
RSTRING_LEN
(
str
),
format
,
ap
);
va_end
(
ap
);
mrb_str_resize
(
mrb
,
str
,
RSTRING_LEN
(
str
)
-
1
);
mrb_ary_push
(
mrb
,
ary
,
str
);
mrb_gc_arena_restore
(
mrb
,
ai
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment