Line data Source code
1 : #include "mem.h"
2 :
3 8174 : Return memory_guarded_size(
4 : size_t left,
5 : size_t right,
6 : size_t *product)
7 : {
8 : /** Return status
9 : * The status that will be passed to return() before exiting
10 : * By default, the function worked without errors
11 : */
12 8174 : Return status = SUCCESS;
13 :
14 8174 : if(left != 0 && right > SIZE_MAX / left)
15 : {
16 0 : status = FAILURE;
17 0 : telemetry_overflow_guard_failure();
18 : }
19 :
20 8174 : if(SUCCESS == status)
21 : {
22 8174 : *product = left * right;
23 : }
24 :
25 8174 : provide(status);
26 : }
|