selinux/libsepol
Nicolas Iooss 13eaba21ef libsepol: make num_* unsigned int in module_to_cil
Using signed integer to represent counts can troube some gcc
optimisation passes, for example in
https://github.com/fishilico/selinux/runs/2125501324?check_suite_focus=true#step:9:107

      In function ‘name_list_to_string’,
          inlined from ‘constraint_expr_to_string’ at module_to_cil.c:1799:11:
      module_to_cil.c:1156:8: error: argument 1 range
      [18446744071562067968, 18446744073709551615] exceeds maximum
      object size 9223372036854775807 [-Werror=alloc-size-larger-than=]
       1156 |  str = malloc(len);
            |        ^~~~~~~~~~~
      In file included from module_to_cil.c:39:
      module_to_cil.c: In function ‘constraint_expr_to_string’:
      /usr/include/stdlib.h:539:14: note: in a call to allocation
      function ‘malloc’ declared here
        539 | extern void *malloc (size_t __size) __THROW __attribute_malloc__
            |              ^~~~~~

The wide range (from 18446744071562067968 = 0xffffffff80000000 to
18446744073709551615 = 0xffffffffffffffff) was caused by num_names being
a signed int used in "len += num_names;", even though it should always
be non-negative.

Prevent such issues from occurring by using "unsigned int" where
appropriate.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
2021-03-18 10:04:57 -04:00
..
cil libsepol/cil: do not leak avrulex_ioctl_table memory when an error occurs 2021-03-17 08:46:36 +01:00
include libsepol: Create function ebitmap_highest_set_bit() 2021-02-19 16:30:11 +01:00
man selinux: Update manpages after removing legacy boolean and user code 2019-07-29 23:46:47 +02:00
src libsepol: make num_* unsigned int in module_to_cil 2021-03-18 10:04:57 -04:00
tests libsepol/tests: drop ncurses dependency 2020-05-04 10:31:44 +02:00
utils libsepol: build: follow standard semantics for DESTDIR and PREFIX 2018-02-14 15:59:36 +01:00
.gitignore libsepol: build cil into libsepol 2014-08-26 08:03:31 -04:00
COPYING initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
Makefile libsepol: build cil into libsepol 2014-08-26 08:03:31 -04:00
VERSION Update VERSIONs to 3.2 for release. 2021-03-04 16:42:59 +01:00