The embodiment of the invention provides a defect detection method and
system for a cross-architecture
firmware heap memory. The method comprises the steps: acquiring an application program in a simulator and
firmware, and analyzing the application program in the simulator based on a
binary translation technology, so as to enable the application program to be matched with a preset test environmentsystem architecture; and performing mapping to generate a
shadow memory by traversing and executing the registered heap memory read-write hook function and the heap memory allocation hook function, and executing a preset memory defect detection
algorithm based on the
shadow memory to obtain a heap memory defect detection result. According to the embodiment of the invention, the cross-platform characteristic of the execution module is simulated; a detection tool does not need to be deployed into equipment where
firmware is located, the unpractical requirement that a traditional memory detection tool needs to be deployed in the device is greatly overcome, the firmware
test efficiency is improved, the problem that the storage space of the IoT device is limited is solved, and meanwhile, the memory defect detection module also provides an
effective solution for detecting various heap
memory defects in a cross-architecture firmware scene.