Skip to content

Commit

Permalink
Merge r239873 - WorkQueue::concurrentApply() passes a raw pointer to …
Browse files Browse the repository at this point in the history
…a temporary String to Thread::create().

https://bugs.webkit.org/show_bug.cgi?id=191350

Reviewed by Brent Fulgham.

The non COCOA version of WorkQueue::concurrentApply() creates a temporary
String for the threadName and passes the raw pointer of this String to
Thread::create(). After freeing this String, Thread::entryPoint() uses
the raw char pointer to internally initialize the thread.

The fix is to use a single literal string for all the threads' names since
they are created for a thread-pool.

* wtf/WorkQueue.cpp:
(WTF::WorkQueue::concurrentApply):
  • Loading branch information
Said Abou-Hallawa authored and mcatanzaro committed Jan 14, 2019
1 parent 2b22a29 commit ba972e0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions Source/WTF/ChangeLog
@@ -1,3 +1,21 @@
2019-01-11 Said Abou-Hallawa <sabouhallawa@apple.com>

WorkQueue::concurrentApply() passes a raw pointer to a temporary String to Thread::create().
https://bugs.webkit.org/show_bug.cgi?id=191350

Reviewed by Brent Fulgham.

The non COCOA version of WorkQueue::concurrentApply() creates a temporary
String for the threadName and passes the raw pointer of this String to
Thread::create(). After freeing this String, Thread::entryPoint() uses
the raw char pointer to internally initialize the thread.

The fix is to use a single literal string for all the threads' names since
they are created for a thread-pool.

* wtf/WorkQueue.cpp:
(WTF::WorkQueue::concurrentApply):

2018-12-14 Darin Adler <darin@apple.com>

Verify size is valid in USE_SYSTEM_MALLOC version of tryAllocateZeroedVirtualPages
Expand Down
2 changes: 1 addition & 1 deletion Source/WTF/wtf/WorkQueue.cpp
Expand Up @@ -75,7 +75,7 @@ void WorkQueue::concurrentApply(size_t iterations, WTF::Function<void (size_t in

m_workers.reserveInitialCapacity(threadCount);
for (unsigned i = 0; i < threadCount; ++i) {
m_workers.append(Thread::create(String::format("ThreadPool Worker %u", i).utf8().data(), [this] {
m_workers.append(Thread::create("ThreadPool Worker", [this] {
threadBody();
}));
}
Expand Down

0 comments on commit ba972e0

Please sign in to comment.