[set] in hb_set_set() avoid calling memcpy on nullptr.
This commit is contained in:
parent
2b9cb29923
commit
c581d11eba
|
@ -488,6 +488,11 @@ struct hb_set_t
|
||||||
if (!resize (count))
|
if (!resize (count))
|
||||||
return;
|
return;
|
||||||
population = other.population;
|
population = other.population;
|
||||||
|
|
||||||
|
if (!count)
|
||||||
|
// memcpy is not necessary if the vectors are zero length. This avoids possibly
|
||||||
|
// passing nullptr to memcpy.
|
||||||
|
return;
|
||||||
memcpy ((void *) pages, (const void *) other.pages, count * pages.item_size);
|
memcpy ((void *) pages, (const void *) other.pages, count * pages.item_size);
|
||||||
memcpy ((void *) page_map, (const void *) other.page_map, count * page_map.item_size);
|
memcpy ((void *) page_map, (const void *) other.page_map, count * page_map.item_size);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue