| 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 #include <assert.h> | 7 #include <assert.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdio.h> | 9 #include <stdio.h> |
| 10 #include <stdlib.h> | 10 #include <stdlib.h> |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 }%% | 95 }%% |
| 96 | 96 |
| 97 %% write data; | 97 %% write data; |
| 98 | 98 |
| 99 | 99 |
| 100 Bool ValidateChunkIA32(const uint8_t *data, size_t size, | 100 Bool ValidateChunkIA32(const uint8_t *data, size_t size, |
| 101 enum validation_options options, | 101 enum validation_options options, |
| 102 const NaClCPUFeaturesX86 *cpu_features, | 102 const NaClCPUFeaturesX86 *cpu_features, |
| 103 validation_callback_func user_callback, | 103 validation_callback_func user_callback, |
| 104 void *callback_data) { | 104 void *callback_data) { |
| 105 uint8_t *valid_targets = BitmapAllocate(size); | 105 bitmap_word *valid_targets = BitmapAllocate(size); |
| 106 uint8_t *jump_dests = BitmapAllocate(size); | 106 bitmap_word *jump_dests = BitmapAllocate(size); |
| 107 const uint8_t *current_position; | 107 const uint8_t *current_position; |
| 108 const uint8_t *end_of_bundle; | 108 const uint8_t *end_of_bundle; |
| 109 int result = TRUE; | 109 int result = TRUE; |
| 110 | 110 |
| 111 CHECK(size % kBundleSize == 0); | 111 CHECK(size % kBundleSize == 0); |
| 112 | 112 |
| 113 if (!valid_targets || !jump_dests) { | 113 if (!valid_targets || !jump_dests) { |
| 114 result = FALSE; | 114 result = FALSE; |
| 115 goto error_detected; | 115 goto error_detected; |
| 116 } | 116 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 134 } | 134 } |
| 135 | 135 |
| 136 result &= ProcessInvalidJumpTargets(data, size, valid_targets, jump_dests, | 136 result &= ProcessInvalidJumpTargets(data, size, valid_targets, jump_dests, |
| 137 user_callback, callback_data); | 137 user_callback, callback_data); |
| 138 | 138 |
| 139 error_detected: | 139 error_detected: |
| 140 free(jump_dests); | 140 free(jump_dests); |
| 141 free(valid_targets); | 141 free(valid_targets); |
| 142 return result; | 142 return result; |
| 143 } | 143 } |
| OLD | NEW |