Skip to content
Snippets Groups Projects
  1. Feb 16, 2022
  2. Feb 11, 2022
  3. Feb 02, 2022
  4. Jan 28, 2022
    • Olivier Fourdan's avatar
      render: Fix build with gcc 12 · 1d98f8b7
      Olivier Fourdan authored
      
      The xserver fails to compile with the latest gcc 12:
      
       render/picture.c: In function ‘CreateSolidPicture’:
       render/picture.c:874:26: error: array subscript ‘union _SourcePict[0]’ is partly outside array bounds of ‘unsigned char[16]’ [-Werror=array-bounds]
        874 |     pPicture->pSourcePict->type = SourcePictTypeSolidFill;
            |                          ^~
       render/picture.c:868:45: note: object of size 16 allocated by ‘malloc’
        868 |     pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictSolidFill));
            |                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       render/picture.c: In function ‘CreateLinearGradientPicture’:
       render/picture.c:906:26: error: array subscript ‘union _SourcePict[0]’ is partly outside array bounds of ‘unsigned char[32]’ [-Werror=array-bounds]
        906 |     pPicture->pSourcePict->linear.type = SourcePictTypeLinear;
            |                          ^~
       render/picture.c:899:45: note: object of size 32 allocated by ‘malloc’
        899 |     pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictLinearGradient));
            |                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       render/picture.c: In function ‘CreateConicalGradientPicture’:
       render/picture.c:989:26: error: array subscript ‘union _SourcePict[0]’ is partly outside array bounds of ‘unsigned char[32]’ [-Werror=array-bounds]
        989 |     pPicture->pSourcePict->conical.type = SourcePictTypeConical;
            |                          ^~
       render/picture.c:982:45: note: object of size 32 allocated by ‘malloc’
        982 |     pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictConicalGradient));
            |                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       cc1: some warnings being treated as errors
       ninja: build stopped: subcommand failed.
      
      This is because gcc 12 has become stricter and raises a warning now.
      
      Fix the warning/error by allocating enough memory to store the union
      struct.
      
      Signed-off-by: default avatarOlivier Fourdan <ofourdan@redhat.com>
      Acked-by: default avatarMichel Dänzer <mdaenzer@redhat.com>
      Closes: xorg/xserver#1256
      (cherry picked from commit c6b0dcb8)
      1d98f8b7
  5. Jan 19, 2022
  6. Jan 18, 2022
  7. Jan 14, 2022
  8. Dec 24, 2021
  9. Dec 20, 2021
  10. Dec 19, 2021
  11. Dec 17, 2021
  12. Dec 16, 2021
  13. Dec 14, 2021
  14. Dec 10, 2021
  15. Dec 08, 2021
  16. Dec 07, 2021
  17. Dec 06, 2021
  18. Dec 05, 2021
Loading