US 11,755,723 B2
Device and method for validation of virtual function pointers
Ting Dai, Singapore (SG); Yongzheng Wu, Singapore (SG); and Tieyan Li, Singapore (SG)
Assigned to HUAWEI TECHNOLOGIES CO., LTD., Shenzhen (CN)
Filed by Huawei Technologies Co., Ltd., Shenzhen (CN)
Filed on Apr. 22, 2021, as Appl. No. 17/237,388.
Application 17/237,388 is a continuation of application No. PCT/CN2018/111412, filed on Oct. 23, 2018.
Prior Publication US 2021/0240820 A1, Aug. 5, 2021
Int. Cl. G06F 21/00 (2013.01); G06F 21/54 (2013.01); G06F 8/41 (2018.01)
CPC G06F 21/54 (2013.01) [G06F 8/41 (2013.01); G06F 2221/033 (2013.01)] 20 Claims
OG exemplary drawing
 
1. A device comprising:
a memory configured to store instructions; and
a processor coupled to the memory, wherein the instructions cause the processor to be configured to:
compile a source code file comprising:
one or more classes, wherein each of the one or more classes comprises a first virtual table comprising at least one virtual function pointer pointing to a first virtual function; and
a virtual function invocation site associated with a second virtual function in one of the one or more classes,
wherein in a manner to compile the source code file, the instructions further cause the processor to be configured to:
associate a first security check function with the virtual function invocation site to execute the first security check function prior to an invocation of the second virtual function;
generate a class hierarchy hash table (CHHT) by:
hashing, for each of the one or more classes, a first address of the first virtual table with each of the at least one virtual function pointer to produce a first hash result for each of the at least one viral function pointer;
associating the first hash result with a first indicator, and
populating the CHHT with the first hash result and the first indicator; and
determine, using the first security check function whether a first virtual function pointer of the second virtual function is valid by looking up a second indicator in the CHHT according to a second hash result of the first virtual function pointer and a second address of a second virtual table comprising the first virtual function pointer.