| 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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 | 304 |
| 305 }%% | 305 }%% |
| 306 | 306 |
| 307 %% write data; | 307 %% write data; |
| 308 | 308 |
| 309 Bool ValidateChunkAMD64(const uint8_t *data, size_t size, | 309 Bool ValidateChunkAMD64(const uint8_t *data, size_t size, |
| 310 enum validation_options options, | 310 enum validation_options options, |
| 311 const NaClCPUFeaturesX86 *cpu_features, | 311 const NaClCPUFeaturesX86 *cpu_features, |
| 312 validation_callback_func user_callback, | 312 validation_callback_func user_callback, |
| 313 void *callback_data) { | 313 void *callback_data) { |
| 314 uint8_t *valid_targets = BitmapAllocate(size); | 314 bitmap_word *valid_targets = BitmapAllocate(size); |
| 315 uint8_t *jump_dests = BitmapAllocate(size); | 315 bitmap_word *jump_dests = BitmapAllocate(size); |
| 316 const uint8_t *current_position; | 316 const uint8_t *current_position; |
| 317 const uint8_t *end_of_bundle; | 317 const uint8_t *end_of_bundle; |
| 318 int result = TRUE; | 318 int result = TRUE; |
| 319 | 319 |
| 320 CHECK(size % kBundleSize == 0); | 320 CHECK(size % kBundleSize == 0); |
| 321 | 321 |
| 322 if (!valid_targets || !jump_dests) { | 322 if (!valid_targets || !jump_dests) { |
| 323 result = FALSE; | 323 result = FALSE; |
| 324 goto error_detected; | 324 goto error_detected; |
| 325 } | 325 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 } | 361 } |
| 362 | 362 |
| 363 result &= ProcessInvalidJumpTargets(data, size, valid_targets, jump_dests, | 363 result &= ProcessInvalidJumpTargets(data, size, valid_targets, jump_dests, |
| 364 user_callback, callback_data); | 364 user_callback, callback_data); |
| 365 | 365 |
| 366 error_detected: | 366 error_detected: |
| 367 free(jump_dests); | 367 free(jump_dests); |
| 368 free(valid_targets); | 368 free(valid_targets); |
| 369 return result; | 369 return result; |
| 370 } | 370 } |
| OLD | NEW |