php / php/php-src

PHP 8.2 build warnings: -Warray-bounds, -Wmaybe-uninitialized

Aperta
#23,633 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Category: Build System Status: Needs Triage
Lingua principale
C
Stelle
40.4k
Fork
8.1k
Merge medio
2g 13h
PR unite (30g)
96

Descrizione

buildconf, ./configure --with-pear --enable-xml, followed by make -j16 included the following warnings:

zend_API.c -Warray-bounds
/usr/src/php/Zend/zend_API.c: In function 'zend_register_functions':
/usr/src/php/Zend/zend_API.c:2843:49: warning: array subscript 'zend_function {aka union _zend_function}[0]' is partly outside array bounds of 'unsigned char[136]' [-Warray-bounds]
 2843 |                 uint32_t num_args = reg_function->common.num_args;
      |                                                 ^~
/usr/src/php/Zend/zend_API.c:2833:32: note: object of size 136 allocated by 'malloc'
 2833 |                 reg_function = malloc(sizeof(zend_internal_function));
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/php/Zend/zend_API.c:2844:33: warning: array subscript 'zend_function {aka union _zend_function}[0]' is partly outside array bounds of 'unsigned char[136]' [-Warray-bounds]
 2844 |                 if (reg_function->common.fn_flags & ZEND_ACC_VARIADIC) {
      |                                 ^~
/usr/src/php/Zend/zend_API.c:2833:32: note: object of size 136 allocated by 'malloc'
 2833 |                 reg_function = malloc(sizeof(zend_internal_function));
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/php/Zend/zend_API.c:2849:33: warning: array subscript 'zend_function {aka union _zend_function}[0]' is partly outside array bounds of 'unsigned char[136]' [-Warray-bounds]
 2849 |                 if (reg_function->common.arg_info && num_args) {
      |                                 ^~
/usr/src/php/Zend/zend_API.c:2833:32: note: object of size 136 allocated by 'malloc'
 2833 |                 reg_function = malloc(sizeof(zend_internal_function));
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/php/Zend/zend_API.c:2855:49: warning: array subscript 'zend_function {aka union _zend_function}[0]' is partly outside array bounds of 'unsigned char[136]' [-Warray-bounds]
 2855 |                                     reg_function->common.fn_flags |= ZEND_ACC_HAS_TYPE_HINTS;
      |                                                 ^~
/usr/src/php/Zend/zend_API.c:2833:32: note: object of size 136 allocated by 'malloc'
 2833 |                 reg_function = malloc(sizeof(zend_internal_function));
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/php/Zend/zend_API.c:2855:49: warning: array subscript 'zend_function {aka union _zend_function}[0]' is partly outside array bounds of 'unsigned char[136]' [-Warray-bounds]
 2855 |                                     reg_function->common.fn_flags |= ZEND_ACC_HAS_TYPE_HINTS;
      |                                                 ^~
/usr/src/php/Zend/zend_API.c:2833:32: note: object of size 136 allocated by 'malloc'
 2833 |                 reg_function = malloc(sizeof(zend_internal_function));
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/php/Zend/zend_API.c:2871:34: warning: array subscript 'zend_function {aka union _zend_function}[0]' is partly outside array bounds of 'unsigned char[136]' [-Warray-bounds]
 2871 |                     (reg_function->common.fn_flags & (ZEND_ACC_HAS_RETURN_TYPE|ZEND_ACC_HAS_TYPE_HINTS))) {
      |                                  ^~
/usr/src/php/Zend/zend_API.c:2833:32: note: object of size 136 allocated by 'malloc'
 2833 |                 reg_function = malloc(sizeof(zend_internal_function));
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/php/Zend/zend_API.c:2881:37: warning: array subscript 'zend_function {aka union _zend_function}[0]' is partly outside array bounds of 'unsigned char[136]' [-Warray-bounds]
 2881 |                         reg_function->common.arg_info = new_arg_info + 1;
      |                                     ^~
/usr/src/php/Zend/zend_API.c:2833:32: note: object of size 136 allocated by 'malloc'
 2833 |                 reg_function = malloc(sizeof(zend_internal_function));
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ext/opcache/jit/zend_jit_trace.c -Wmaybe-uninitialized
In file included from /usr/src/php/ext/opcache/jit/zend_jit.c:4445:
ext/opcache/jit/zend_jit_trace.c: In function 'zend_jit_trace':
ext/opcache/jit/zend_jit_trace.c:6533:86: warning: 'gen_handler' may be used uninitialized [-Wmaybe-uninitialized]
 6533 |                                                                         (gen_handler || !ra || !ra[ssa_op->op1_def]));
      |                                                                                      ^~
ext/opcache/jit/zend_jit_trace.c:4300:30: note: 'gen_handler' was declared here
 4300 |                         bool gen_handler;
      |                              ^~~~~~~~~~~

while 8.2 is security only, it should still support building from source

Built using gcc (Debian 12.2.0-14+deb12u1) 12.2.0 against latest 8.2 commit, 4fa25b04e76ccafda9a778f2ba2aaeb66fad1037

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Riproduci il report con buildconf, ./configure --with-pear --enable-xml e make -j16 usando GCC 12.2.0. Ispeziona Zend/zend_API.c nei pressi di zend_register_functions ed ext/opcache/jit/zend_jit_trace.c nei pressi di zend_jit_trace, quindi verifica che la compilazione del codice sorgente di PHP 8.2 venga completata senza questi avvisi.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
c
Ambito
build-system
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Attiva
Chiarezza
Abbastanza chiara
Idoneità per principianti
62/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.