aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2016-08-23 17:17:43 +0200
committerSverker Eriksson <[email protected]>2016-08-23 18:39:05 +0200
commiteb889b196ecb8128b4cb232ab2ebb2715c9b8993 (patch)
tree0f419e64c064db288339c2e5da7868830332cb87 /erts
parent8f0d1988c0943491e89428b54cd457c8e8e580a2 (diff)
downloadotp-eb889b196ecb8128b4cb232ab2ebb2715c9b8993.tar.gz
otp-eb889b196ecb8128b4cb232ab2ebb2715c9b8993.tar.bz2
otp-eb889b196ecb8128b4cb232ab2ebb2715c9b8993.zip
erts: Reject an invalid beam code header size
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/beam/beam_load.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/erts/emulator/beam/beam_load.c b/erts/emulator/beam/beam_load.c
index 30913910b6..8ad7862daa 100644
--- a/erts/emulator/beam/beam_load.c
+++ b/erts/emulator/beam/beam_load.c
@@ -1783,6 +1783,10 @@ read_code_header(LoaderState* stp)
*/
GetInt(stp, 4, head_size);
+ if (head_size > stp->file_left) {
+ LoadError2(stp, "invalid code header size %u; bytes left %u",
+ head_size, stp->file_left);
+ }
stp->code_start = stp->file_p + head_size;
stp->code_size = stp->file_left - head_size;
stp->file_left = head_size;