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
8cb730ae
Commit
8cb730ae
authored
Jun 21, 2013
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1296 from kyab/fallback-for-crc-buffer
Add fallback for allocate CRC buffer
parents
31b3e3cf
31fbfb51
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
src/load.c
src/load.c
+7
-2
No files found.
src/load.c
View file @
8cb730ae
...
@@ -539,7 +539,9 @@ mrb_read_irep_file(mrb_state *mrb, FILE* fp)
...
@@ -539,7 +539,9 @@ mrb_read_irep_file(mrb_state *mrb, FILE* fp)
size_t
sirep
;
size_t
sirep
;
struct
rite_section_header
section_header
;
struct
rite_section_header
section_header
;
long
fpos
;
long
fpos
;
const
size_t
block_size
=
1
<<
14
;
size_t
block_size
=
1
<<
14
;
const
uint8_t
block_fallback_count
=
4
;
int
i
;
const
size_t
buf_size
=
sizeof
(
struct
rite_binary_header
);
const
size_t
buf_size
=
sizeof
(
struct
rite_binary_header
);
if
((
mrb
==
NULL
)
||
(
fp
==
NULL
))
{
if
((
mrb
==
NULL
)
||
(
fp
==
NULL
))
{
...
@@ -564,7 +566,10 @@ mrb_read_irep_file(mrb_state *mrb, FILE* fp)
...
@@ -564,7 +566,10 @@ mrb_read_irep_file(mrb_state *mrb, FILE* fp)
/* verify CRC */
/* verify CRC */
fpos
=
ftell
(
fp
);
fpos
=
ftell
(
fp
);
/* You don't need use SIZE_ERROR as block_size is enough small. */
/* You don't need use SIZE_ERROR as block_size is enough small. */
buf
=
mrb_malloc
(
mrb
,
block_size
);
for
(
i
=
0
;
i
<
block_fallback_count
;
i
++
,
block_size
>>=
1
){
buf
=
mrb_malloc
(
mrb
,
block_size
);
if
(
buf
)
break
;
}
if
(
!
buf
)
{
if
(
!
buf
)
{
return
MRB_DUMP_GENERAL_FAILURE
;
return
MRB_DUMP_GENERAL_FAILURE
;
}
}
...
...
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