diff options
author | Tristan Gingold <gingold@adacore.com> | 2013-12-03 16:46:59 +0100 |
---|---|---|
committer | Tristan Gingold <gingold@adacore.com> | 2013-12-03 17:31:46 +0100 |
commit | c2a5914e1b686cd765cf95e09be89584eba99741 (patch) | |
tree | d1673f0094358b09f49c3ea3641065153de72c78 /gas/config/tc-i386-intel.c | |
parent | 11a6da561751f4fd91ae64c2d51c2cd8166cad1e (diff) | |
download | gdb-c2a5914e1b686cd765cf95e09be89584eba99741.zip gdb-c2a5914e1b686cd765cf95e09be89584eba99741.tar.gz gdb-c2a5914e1b686cd765cf95e09be89584eba99741.tar.bz2 |
Fix crash on intelbad.
gas/
2013-12-03 Tristan Gingold <gingold@adacore.com>
* config/tc-i386-intel.c (i386_intel_simplify): Avoid arithmetic
overflow on pointers.
Diffstat (limited to 'gas/config/tc-i386-intel.c')
-rw-r--r-- | gas/config/tc-i386-intel.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/gas/config/tc-i386-intel.c b/gas/config/tc-i386-intel.c index 8a2224a..6df17e2 100644 --- a/gas/config/tc-i386-intel.c +++ b/gas/config/tc-i386-intel.c @@ -417,23 +417,21 @@ static int i386_intel_simplify (expressionS *e) if (this_operand >= 0 && intel_state.in_bracket) { expressionS *scale = NULL; - - if (intel_state.index) - --scale; + int has_index = (intel_state.index != NULL); if (!intel_state.in_scale++) intel_state.scale_factor = 1; ret = i386_intel_simplify_symbol (e->X_add_symbol); - if (ret && !scale && intel_state.index) + if (ret && !has_index && intel_state.index) scale = symbol_get_value_expression (e->X_op_symbol); if (ret) ret = i386_intel_simplify_symbol (e->X_op_symbol); - if (ret && !scale && intel_state.index) + if (ret && !scale && !has_index && intel_state.index) scale = symbol_get_value_expression (e->X_add_symbol); - if (ret && scale && (scale + 1)) + if (ret && scale) { resolve_expression (scale); if (scale->X_op != O_constant |