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

Side by Side Diff: src/top.cc

Issue 67248: - Fix buffer overflow in the pre-allocated memory thread. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 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
« no previous file with comments | « no previous file | test/mjsunit/regexp-multiline-stack-trace.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 // When the thread starts running it will allocate a fixed number of bytes 116 // When the thread starts running it will allocate a fixed number of bytes
117 // on the stack and publish the location of this memory for others to use. 117 // on the stack and publish the location of this memory for others to use.
118 void Run() { 118 void Run() {
119 EmbeddedVector<char, 15 * 1024> local_buffer; 119 EmbeddedVector<char, 15 * 1024> local_buffer;
120 120
121 // Initialize the buffer with a known good value. 121 // Initialize the buffer with a known good value.
122 OS::StrNCpy(local_buffer, "Trace data was not generated.\n", 122 OS::StrNCpy(local_buffer, "Trace data was not generated.\n",
123 local_buffer.length()); 123 local_buffer.length());
124 124
125 // Publish the local buffer and signal its availability. 125 // Publish the local buffer and signal its availability.
126 data_ = &local_buffer[0]; 126 data_ = local_buffer.start();
127 length_ = sizeof(local_buffer); 127 length_ = local_buffer.length();
128 data_ready_semaphore_->Signal(); 128 data_ready_semaphore_->Signal();
129 129
130 while (keep_running_) { 130 while (keep_running_) {
131 // This thread will wait here until the end of time. 131 // This thread will wait here until the end of time.
132 wait_for_ever_semaphore_->Wait(); 132 wait_for_ever_semaphore_->Wait();
133 } 133 }
134 134
135 // Make sure we access the buffer after the wait to remove all possibility 135 // Make sure we access the buffer after the wait to remove all possibility
136 // of it being optimized away. 136 // of it being optimized away.
137 OS::StrNCpy(local_buffer, "PreallocatedMemoryThread shutting down.\n", 137 OS::StrNCpy(local_buffer, "PreallocatedMemoryThread shutting down.\n",
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 Top::break_access_->Lock(); 912 Top::break_access_->Lock();
913 } 913 }
914 914
915 915
916 ExecutionAccess::~ExecutionAccess() { 916 ExecutionAccess::~ExecutionAccess() {
917 Top::break_access_->Unlock(); 917 Top::break_access_->Unlock();
918 } 918 }
919 919
920 920
921 } } // namespace v8::internal 921 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regexp-multiline-stack-trace.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698