Bug 1123002 - Convert XPCStringConvert::ZoneStringCache::mBuffer to void*; r=mccr8

This variable is only used for pointer comparison in order to compute
a cache match.  This patch converts the type of the variable to void*
so that it can still be used for the pointer comparison, but not for
any other purpose, including dereferencing, since the pointer may
potentially be dangling if the string buffer dies.
This commit is contained in:
Ehsan Akhgari 2015-01-17 20:29:16 -05:00
Родитель 376b92ae54
Коммит d161a0c991
1 изменённых файлов: 5 добавлений и 1 удалений

Просмотреть файл

@ -206,7 +206,11 @@ class XPCStringConvert
// would take a lot more machinery.
struct ZoneStringCache
{
nsStringBuffer* mBuffer;
// mString owns mBuffer. mString is a JS thing, so it can only die
// during GC. We clear mString and mBuffer during GC. As long as
// the above holds, mBuffer should not be a dangling pointer, so
// using this as a cache key should be safe.
void* mBuffer;
JSString* mString;
};