LCOV - code coverage report
Current view: top level - libs/mem/src - mem_guarded_size.c (source / functions) Coverage Total Hit
Test: coverage.info Lines: 75.0 % 8 6
Test Date: 2026-01-12 05:34:38 Functions: 100.0 % 1 1

            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              : }
        

Generated by: LCOV version 2.0-1