diff options
| author | Vlad Ionescu <vlad@lshift.net> | 2010-01-29 19:54:06 +0000 |
|---|---|---|
| committer | Vlad Ionescu <vlad@lshift.net> | 2010-01-29 19:54:06 +0000 |
| commit | 11e63b9c20ef5201cd6c65d4b8c3ff90f18c3726 (patch) | |
| tree | ab240af657962c836122b1dac11bfc564a3b665e /codegen.py | |
| parent | 340b9dab1e3fb9a03c7addba549a04472e705750 (diff) | |
| download | rabbitmq-server-git-11e63b9c20ef5201cd6c65d4b8c3ff90f18c3726.tar.gz | |
improving shortstr overflow checking
Diffstat (limited to 'codegen.py')
| -rw-r--r-- | codegen.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/codegen.py b/codegen.py index 6f39574f26..648983f1f2 100644 --- a/codegen.py +++ b/codegen.py @@ -214,6 +214,8 @@ def genErl(spec): elif type == 'table': print " F%d = rabbit_binary_parser:parse_table(F%dTab)," % \ (f.index, f.index) + elif type == 'shortstr': + print " if F%dLen > 255 -> exit(method_field_shortstr_overflow); true -> ok end," % (f.index) else: pass @@ -246,7 +248,10 @@ def genErl(spec): elif type == 'table': print " F%dTab = rabbit_binary_generator:generate_table(F%d)," % (f.index, f.index) print " F%dLen = size(F%dTab)," % (f.index, f.index) - elif type in ['shortstr', 'longstr']: + elif type == 'shortstr': + print " F%dLen = size(F%d)," % (f.index, f.index) + print " if F%dLen > 255 -> exit(method_field_shortstr_overflow); true -> ok end," % (f.index) + elif type == 'longstr': print " F%dLen = size(F%d)," % (f.index, f.index) else: pass |
