Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(351)

Side by Side Diff: src/trusted/validator/ncfileutil.c

Issue 10116004: Eliminate bundle_size parameter from validator interface. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Merge Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2011 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 * ncfileutil.c - open an executable file. FOR TESTING ONLY. 8 * ncfileutil.c - open an executable file. FOR TESTING ONLY.
9 */ 9 */
10 10
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 phnum = h.h32.e_phnum; 134 phnum = h.h32.e_phnum;
135 shnum = h.h32.e_shnum; 135 shnum = h.h32.e_shnum;
136 } else { 136 } else {
137 ncf->error_fn("nc_load(%s): bad EI CLASS %d %s\n", ncf->fname, 137 ncf->error_fn("nc_load(%s): bad EI CLASS %d %s\n", ncf->fname,
138 h.h32.e_ident[EI_CLASS], 138 h.h32.e_ident[EI_CLASS],
139 GetEiClassName(h.h32.e_ident[EI_CLASS])); 139 GetEiClassName(h.h32.e_ident[EI_CLASS]));
140 return -1; 140 return -1;
141 } 141 }
142 } 142 }
143 143
144 /* We now support only 32-byte bundle alignment. */
145 ncf->ncalign = 32;
146
147 /* Read the program header table */ 144 /* Read the program header table */
148 if (phnum <= 0 || phnum > kMaxPhnum) { 145 if (phnum <= 0 || phnum > kMaxPhnum) {
149 ncf->error_fn("nc_load(%s): e_phnum %d > kMaxPhnum %d\n", 146 ncf->error_fn("nc_load(%s): e_phnum %d > kMaxPhnum %d\n",
150 ncf->fname, phnum, kMaxPhnum); 147 ncf->fname, phnum, kMaxPhnum);
151 return -1; 148 return -1;
152 } 149 }
153 ncf->phnum = phnum; 150 ncf->phnum = phnum;
154 ncf->pheaders = (Elf_Phdr *)calloc(phnum, sizeof(Elf_Phdr)); 151 ncf->pheaders = (Elf_Phdr *)calloc(phnum, sizeof(Elf_Phdr));
155 if (NULL == ncf->pheaders) { 152 if (NULL == ncf->pheaders) {
156 ncf->error_fn("nc_load(%s): calloc(%d, %"NACL_PRIdS") failed\n", 153 ncf->error_fn("nc_load(%s): calloc(%d, %"NACL_PRIdS") failed\n",
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 for (ii = 0; ii < ncf->shnum; ii++) { 354 for (ii = 0; ii < ncf->shnum; ii++) {
358 if ((ncf->sheaders[ii].sh_flags & SHF_EXECINSTR) == SHF_EXECINSTR) { 355 if ((ncf->sheaders[ii].sh_flags & SHF_EXECINSTR) == SHF_EXECINSTR) {
359 if (ncf->sheaders[ii].sh_addr < base) base = ncf->sheaders[ii].sh_addr; 356 if (ncf->sheaders[ii].sh_addr < base) base = ncf->sheaders[ii].sh_addr;
360 if (ncf->sheaders[ii].sh_addr + ncf->sheaders[ii].sh_size > limit) 357 if (ncf->sheaders[ii].sh_addr + ncf->sheaders[ii].sh_size > limit)
361 limit = ncf->sheaders[ii].sh_addr + ncf->sheaders[ii].sh_size; 358 limit = ncf->sheaders[ii].sh_addr + ncf->sheaders[ii].sh_size;
362 } 359 }
363 } 360 }
364 *vbase = base; 361 *vbase = base;
365 *vlimit = limit; 362 *vlimit = limit;
366 } 363 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698