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

Unified Diff: src/factory.cc

Issue 149304: Fix unsafe use of DescriptorWriter across allocation.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/factory.cc
===================================================================
--- src/factory.cc (revision 2383)
+++ src/factory.cc (working copy)
@@ -570,12 +570,14 @@
int descriptor_count = 0;
// Copy the descriptors from the array.
- DescriptorWriter w(*result);
- for (DescriptorReader r(*array); !r.eos(); r.advance()) {
- if (!r.IsNullDescriptor()) {
- w.WriteFrom(&r);
+ {
+ DescriptorWriter w(*result);
+ for (DescriptorReader r(*array); !r.eos(); r.advance()) {
+ if (!r.IsNullDescriptor()) {
+ w.WriteFrom(&r);
+ }
+ descriptor_count++;
}
- descriptor_count++;
}
// Number of duplicates detected.
@@ -594,7 +596,10 @@
if (result->LinearSearch(*key, descriptor_count) ==
DescriptorArray::kNotFound) {
CallbacksDescriptor desc(*key, *entry, entry->property_attributes());
- w.Write(&desc);
+ // We do not use a DescriptorWriter because SymbolFromString can
+ // allocate. A DescriptorWriter holds a raw pointer and is
+ // therefore not GC safe.
+ result->Set(descriptor_count, &desc);
descriptor_count++;
} else {
duplicates++;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698