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

Side by Side Diff: src/runtime.cc

Issue 7565009: Fix out-of-bounds access in fetching propery names (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: additional fixes Created 9 years, 4 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
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 4565 matching lines...) Expand 10 before | Expand all | Expand 10 after
4576 } 4576 }
4577 } 4577 }
4578 4578
4579 // Allocate an array with storage for all the property names. 4579 // Allocate an array with storage for all the property names.
4580 Handle<FixedArray> names = 4580 Handle<FixedArray> names =
4581 isolate->factory()->NewFixedArray(total_property_count); 4581 isolate->factory()->NewFixedArray(total_property_count);
4582 4582
4583 // Get the property names. 4583 // Get the property names.
4584 jsproto = obj; 4584 jsproto = obj;
4585 int proto_with_hidden_properties = 0; 4585 int proto_with_hidden_properties = 0;
4586 int next_copy_index = 0;
4586 for (int i = 0; i < length; i++) { 4587 for (int i = 0; i < length; i++) {
4587 jsproto->GetLocalPropertyNames(*names, 4588 jsproto->GetLocalPropertyNames(*names, next_copy_index);
4588 i == 0 ? 0 : local_property_count[i - 1]); 4589 next_copy_index += local_property_count[i];
4589 if (jsproto->HasHiddenProperties()) { 4590 if (jsproto->HasHiddenProperties()) {
4590 proto_with_hidden_properties++; 4591 proto_with_hidden_properties++;
4591 } 4592 }
4592 if (i < length - 1) { 4593 if (i < length - 1) {
4593 jsproto = Handle<JSObject>(JSObject::cast(jsproto->GetPrototype())); 4594 jsproto = Handle<JSObject>(JSObject::cast(jsproto->GetPrototype()));
4594 } 4595 }
4595 } 4596 }
4596 4597
4597 // Filter out name of hidden propeties object. 4598 // Filter out name of hidden propeties object.
4598 if (proto_with_hidden_properties > 0) { 4599 if (proto_with_hidden_properties > 0) {
(...skipping 8222 matching lines...) Expand 10 before | Expand all | Expand 10 after
12821 } else { 12822 } else {
12822 // Handle last resort GC and make sure to allow future allocations 12823 // Handle last resort GC and make sure to allow future allocations
12823 // to grow the heap without causing GCs (if possible). 12824 // to grow the heap without causing GCs (if possible).
12824 isolate->counters()->gc_last_resort_from_js()->Increment(); 12825 isolate->counters()->gc_last_resort_from_js()->Increment();
12825 isolate->heap()->CollectAllGarbage(false); 12826 isolate->heap()->CollectAllGarbage(false);
12826 } 12827 }
12827 } 12828 }
12828 12829
12829 12830
12830 } } // namespace v8::internal 12831 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698