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
f7cf5812
Unverified
Commit
f7cf5812
authored
Apr 17, 2018
by
Yukihiro "Matz" Matsumoto
Committed by
GitHub
Apr 17, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4003 from take-cheeze/int32_overflow
Fallback to float when compiled binary with 64bit compiler.
parents
4880f6dc
87ef6aeb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
src/load.c
src/load.c
+4
-3
src/string.c
src/string.c
+7
-2
No files found.
src/load.c
View file @
f7cf5812
...
...
@@ -126,9 +126,10 @@ read_irep_record_1(mrb_state *mrb, const uint8_t *bin, size_t *len, uint8_t flag
}
src
+=
pool_data_len
;
switch
(
tt
)
{
/* pool data */
case
IREP_TT_FIXNUM
:
irep
->
pool
[
i
]
=
mrb_str_to_inum
(
mrb
,
s
,
10
,
FALSE
);
break
;
case
IREP_TT_FIXNUM
:
{
mrb_value
num
=
mrb_str_to_inum
(
mrb
,
s
,
10
,
FALSE
);
irep
->
pool
[
i
]
=
mrb_float_p
(
num
)
?
mrb_float_pool
(
mrb
,
mrb_float
(
num
))
:
num
;
}
break
;
#ifndef MRB_WITHOUT_FLOAT
case
IREP_TT_FLOAT
:
...
...
src/string.c
View file @
f7cf5812
...
...
@@ -2167,8 +2167,13 @@ mrb_str_len_to_inum(mrb_state *mrb, const char *str, mrb_int len, mrb_int base,
n
*=
base
;
n
+=
c
;
if
(
n
>
(
uint64_t
)
MRB_INT_MAX
+
(
sign
?
0
:
1
))
{
mrb_raisef
(
mrb
,
E_ARGUMENT_ERROR
,
"string (%S) too big for integer"
,
mrb_str_new
(
mrb
,
str
,
pend
-
str
));
if
(
base
==
10
)
{
return
mrb_float_value
(
mrb
,
mrb_str_to_dbl
(
mrb
,
mrb_str_new
(
mrb
,
str
,
len
),
badcheck
));
}
else
{
mrb_raisef
(
mrb
,
E_ARGUMENT_ERROR
,
"string (%S) too big for integer"
,
mrb_str_new
(
mrb
,
str
,
pend
-
str
));
}
}
}
val
=
(
mrb_int
)
n
;
...
...
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