Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
wamr-export-test
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mohammad Mahhouk
wamr-export-test
Commits
8abe6282
Commit
8abe6282
authored
3 years ago
by
Mohammad Mahhouk
Browse files
Options
Downloads
Patches
Plain Diff
fixed the segmentation fault bug
parent
c8ab19ca
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
main.c
+8
-2
8 additions, 2 deletions
main.c
with
8 additions
and
2 deletions
main.c
+
8
−
2
View file @
8abe6282
...
...
@@ -50,12 +50,13 @@ char *read_wasm_binary_to_buffer(char *path, uint32_t *size)
size_t
read_bytes
=
fread
(
buffer
,
1
,
fsize
,
fd
);
if
(
read_bytes
!=
fsize
)
{
free
(
buffer
);
fprintf
(
stderr
,
"file read didnt read the whole file size and returned only %zu instead of %zu
\n
"
,
read_bytes
,
fsize
);
exit
(
EXIT_FAILURE
);
}
fclose
(
fd
);
*
size
=
fsize
+
1
;
buffer
[
fsize
]
=
0
;
*
size
=
fsize
;
//
+ 1;
//
buffer[fsize] = 0;
return
buffer
;
}
...
...
@@ -111,6 +112,11 @@ int main(int argc, char *argv[])
/* parse the WASM file from buffer and create a WASM module */
module
=
wasm_runtime_load
(
buffer
,
size
,
error_buf
,
sizeof
(
error_buf
));
if
(
module
==
NULL
)
{
fprintf
(
stderr
,
"failed to load the module from the buffer
\n
"
);
exit
(
EXIT_FAILURE
);
}
/* create an instance of the WASM module (WASM linear memory is ready) */
module_inst
=
wasm_runtime_instantiate
(
module
,
stack_size
,
heap_size
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment