2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00
Files
bind/lib/isc
Mark Andrews e8dbc5db92 Properly compute the physical memory size
On a 32 bit machine casting to size_t can still lead to an overflow.
Cast to uint64_t.  Also detect all possible negative values for
pages and pagesize to silence warning about possible negative value.

    39#if defined(_SC_PHYS_PAGES) && defined(_SC_PAGESIZE)
    	1. tainted_data_return: Called function sysconf(_SC_PHYS_PAGES),
           and a possible return value may be less than zero.
    	2. assign: Assigning: pages = sysconf(_SC_PHYS_PAGES).
    40        long pages = sysconf(_SC_PHYS_PAGES);
    41        long pagesize = sysconf(_SC_PAGESIZE);
    42
    	3. Condition pages == -1, taking false branch.
    	4. Condition pagesize == -1, taking false branch.
    43        if (pages == -1 || pagesize == -1) {
    44                return (0);
    45        }
    46
    	5. overflow: The expression (size_t)pages * pagesize might be negative,
           but is used in a context that treats it as unsigned.

    CID 498034: (#1 of 1): Overflowed return value (INTEGER_OVERFLOW)
    6. return_overflow: (size_t)pages * pagesize, which might have underflowed,
       is returned from the function.
    47        return ((size_t)pages * pagesize);
    48#endif /* if defined(_SC_PHYS_PAGES) && defined(_SC_PAGESIZE) */
2024-07-31 05:55:30 +00:00
..
2023-02-15 16:44:47 +00:00
2023-02-15 16:44:47 +00:00
2023-02-15 16:44:47 +00:00
2023-08-31 22:08:35 +02:00
2023-08-21 18:39:53 +02:00
2023-02-15 16:44:47 +00:00
2024-02-09 13:11:48 +03:00
2023-02-16 18:35:32 +01:00
2024-05-17 16:03:21 -07:00
2023-12-06 15:15:24 +02:00
2023-02-15 16:44:47 +00:00
2023-02-15 16:44:09 +00:00
2023-08-31 22:08:35 +02:00
2023-09-16 07:32:17 +02:00
2022-11-29 08:54:34 +01:00
2023-04-27 12:38:53 +02:00