| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 /* | 7 /* |
| 8 * This is the core of amd64-mode validator. Please note that this file | 8 * This is the core of amd64-mode validator. Please note that this file |
| 9 * combines ragel machine description and C language actions. Please read | 9 * combines ragel machine description and C language actions. Please read |
| 10 * validator_internals.html first to understand how the whole thing is built: | 10 * validator_internals.html first to understand how the whole thing is built: |
| 11 * it explains how the byte sequences are constructed, what constructs like | 11 * it explains how the byte sequences are constructed, what constructs like |
| 12 * “@{}” or “REX_WRX?” mean, etc. | 12 * “@{}” or “REX_WRX?” mean, etc. |
| 13 */ | 13 */ |
| 14 | 14 |
| 15 #include <assert.h> | 15 #include <assert.h> |
| 16 #include <errno.h> | 16 #include <errno.h> |
| 17 #include <stddef.h> | 17 #include <stddef.h> |
| 18 #include <stdio.h> | 18 #include <stdio.h> |
| 19 #include <stdlib.h> | 19 #include <stdlib.h> |
| 20 #include <string.h> | 20 #include <string.h> |
| 21 | 21 |
| 22 #include "native_client/src/trusted/validator_ragel/bitmap.h" |
| 22 #include "native_client/src/trusted/validator_ragel/unreviewed/validator_interna
l.h" | 23 #include "native_client/src/trusted/validator_ragel/unreviewed/validator_interna
l.h" |
| 23 | 24 |
| 24 %%{ | 25 %%{ |
| 25 machine x86_64_validator; | 26 machine x86_64_validator; |
| 26 alphtype unsigned char; | 27 alphtype unsigned char; |
| 27 variable p current_position; | 28 variable p current_position; |
| 28 variable pe end_of_bundle; | 29 variable pe end_of_bundle; |
| 29 variable eof end_of_bundle; | 30 variable eof end_of_bundle; |
| 30 variable cs current_state; | 31 variable cs current_state; |
| 31 | 32 |
| (...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 */ | 761 */ |
| 761 result &= ProcessInvalidJumpTargets(data, size, valid_targets, jump_dests, | 762 result &= ProcessInvalidJumpTargets(data, size, valid_targets, jump_dests, |
| 762 user_callback, callback_data); | 763 user_callback, callback_data); |
| 763 | 764 |
| 764 /* We only use malloc for a large code sequences */ | 765 /* We only use malloc for a large code sequences */ |
| 765 if (jump_dests != jump_dests_small) free(jump_dests); | 766 if (jump_dests != jump_dests_small) free(jump_dests); |
| 766 if (valid_targets != valid_targets_small) free(valid_targets); | 767 if (valid_targets != valid_targets_small) free(valid_targets); |
| 767 if (!result) errno = EINVAL; | 768 if (!result) errno = EINVAL; |
| 768 return result; | 769 return result; |
| 769 } | 770 } |
| OLD | NEW |