Patent ID: 7664939

Claim:
A method for detecting control flow error in a computer that executes a program, the method comprising: dividing the program into a plurality of code blocks; allocating a unique code block ID to each code block of the plurality of code blocks, the code block IDs being different from program counters; storing in a memory, at a moment when execution of the program is started, the code block ID corresponding to an execution start address; as execution control of the program being executed transits from one code block as a transition source code block to another code block as a transition destination code block, updating the code block ID stored in the memory by use of a code block operation value obtained beforehand for the transition source code block and the transition destination code block, the code block operation value being obtained beforehand based on a value of the code block ID allocated to the transition destination code block and a value of the code block ID allocated to the transition source code block; and judging whether the updated code block ID stored in the memory and the code block ID allocated to the transition destination code block are identical or not, wherein a control flow error is detected if the updated code block ID and the code block ID allocated to the transition destination code block are not identical.