A method for the execution of a binary code of a computer program by a microprocessor, said binary code defining a data structure comprising multiple fields able to be accessed independently of one another including at least one particular field to be read using a pointer, said method comprising the following steps:
- a) writing, to the main memory, the value of the particular field associated with a first field pointer identifier, said first field pointer identifier identifying the field pointer to be used to read the value of said particular field, and then
- b) reading the value of said particular field of the data structure from the main memory, said reading step comprising the following operations:
- b1) obtaining a data structure pointer that points to the start of the data structure, said data structure pointer containing:
- a first range of bits containing the starting address of the data structure in the address space of the computer program, and
- a second, different range of bits containing a data structure pointer identifier, said data structure pointer identifier making it possible to uniquely identify said data structure pointer among a set containing multiple different data structure pointers implemented in the same execution of the binary code by said microprocessor, and then
- b2) constructing a field pointer that points directly to the particular field of the data structure to be read, said field pointer containing:
- a first range of bits containing the starting address of the particular field in the address space of the computer program, and
- a second range of bits containing a second field pointer identifier,
- said construction operation comprising the following sub-operations:
- b2.1) determining the starting address of the particular field from the address contained in the first range of bits of the data structure pointer and the position of the particular field with respect to the start of the data structure, and
- b2.2) determining the second field pointer identifier from the data structure pointer identifier contained in the second range of bits of the data structure pointer obtained in operation b1), and then
- b3) loading, from the main memory, the value of the particular field using the address contained in the first range of bits of the field pointer constructed in operation b2), and then
- b4) checking that the second field identifier contained in the second range of bits of the field pointer constructed in operation b2) corresponds to the first field pointer identifier associated with said same particular field when said value is written to the main memory, and when the first and second field pointer identifiers do not match, triggering the signalling of an execution fault and, in the opposite case, suppressing the triggering of the signalling of an execution fault and processing, with the microprocessor, the loaded value of the particular field,
- wherein:
- in step a), the first field pointer identifier associated with the particular field is determined from the data structure pointer identifier and from an identifier of the particular field that differs for all of the fields of the data structure that are adjacent to the particular field to be read, and
- in operation b2), the second field pointer identifier is additionally determined from the same identifier of the particular field in order to obtain a second field pointer identifier that systematically corresponds to the first field pointer identifier when the identifier of the data structure pointer is identical to the one used to determine the first field pointer identifier.