Bug 1445471 - Recognize invalid HANDLEs in plugin brokering. r=jimm

When InternetOpenA, or some other brokered function that returns handles, fails, we should not return a valid HANDLE id.  We return an id of 0 instead.
This commit is contained in:
David Parks 2018-03-14 12:28:22 -07:00
Родитель 5383105dd9
Коммит 3b52a7becc
1 изменённых файлов: 6 добавлений и 0 удалений

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

@ -638,6 +638,12 @@ inline void EndpointHandler<SERVER>::Copy(uint64_t& aDest, const PSecHandle& aSr
template<> template<>
inline void EndpointHandler<SERVER>::Copy(uint64_t& aDest, void* const & aSrc) inline void EndpointHandler<SERVER>::Copy(uint64_t& aDest, void* const & aSrc)
{ {
// If the HANDLE/HINSTANCE was an error then don't store it.
if (!aSrc) {
aDest = 0;
return;
}
static uint64_t sNextVal = 1; static uint64_t sNextVal = 1;
// Fetch val by reference to update the value in the map // Fetch val by reference to update the value in the map
uint64_t& val = sPtrToIdMap[aSrc]; uint64_t& val = sPtrToIdMap[aSrc];