Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfault with Compress::Raw::Zlib::Z_NULL #17

Closed
atheurer opened this issue Jun 26, 2022 · 6 comments
Closed

Segfault with Compress::Raw::Zlib::Z_NULL #17

atheurer opened this issue Jun 26, 2022 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@atheurer
Copy link

This statement is part of a unit test for IO::Compress
Compress::Raw::Zlib versions 2.105 and older have no problems, anything newer than 2.105 results in segfault.

v2.105:

[root@dhcp31-192 Compress-Raw-Zlib-2.105]# make install
"/usr/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Zlib.bs blib/arch/auto/Compress/Raw/Zlib/Zlib.bs 644
Manifying 1 pod document
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Installing /usr/local/lib64/perl5/5.34/auto/Compress/Raw/Zlib/Zlib.so
Installing /usr/local/lib64/perl5/5.34/Compress/Raw/Zlib.pm
Installing /usr/local/share/man/man3/Compress::Raw::Zlib.3pm
Appending installation info to /usr/lib64/perl5/perllocal.pod
[root@dhcp31-192 Compress-Raw-Zlib-2.105]# /usr/bin/perl -w -e '{ use Compress::Raw::Zlib ; eval "defined Compress::Raw::Zlib::Z_NULL" ; }'
[root@dhcp31-192 Compress-Raw-Zlib-2.105]#

v2.200 & v2.01:

[root@dhcp31-192 Compress-Raw-Zlib-2.200]# make install
"/usr/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Zlib.bs blib/arch/auto/Compress/Raw/Zlib/Zlib.bs 644
Manifying 1 pod document
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Installing /usr/local/lib64/perl5/5.34/auto/Compress/Raw/Zlib/Zlib.so
Installing /usr/local/lib64/perl5/5.34/Compress/Raw/Zlib.pm
Installing /usr/local/share/man/man3/Compress::Raw::Zlib.3pm
Appending installation info to /usr/lib64/perl5/perllocal.pod
[root@dhcp31-192 Compress-Raw-Zlib-2.200]# /usr/bin/perl -w -e '{ use Compress::Raw::Zlib ; eval "defined Compress::Raw::Zlib::Z_NULL" ; }'
Segmentation fault (core dumped)
@atheurer
Copy link
Author

[root@dhcp31-192 Compress-Raw-Zlib]# git bisect bad
8af98773d98efc398e8011e43b0a5bd148f93e93 is the first bad commit
commit 8af98773d98efc398e8011e43b0a5bd148f93e93
Author: pmqs <pmqs@cpan.org>
Date:   Sat Jun 18 16:35:04 2022 +0100

    zlib-ng changes

 .cirrus.yml                                  |  21 +-
 .github/workflows/linux-upstream-zlib-ng.yml |  78 +++++++
 Makefile.PL                                  |  78 ++++---
 Zlib.xs                                      | 319 ++++++++++++++++++---------
 config.in                                    |   1 +
 lib/Compress/Raw/Zlib.pm                     |  10 +-
 t/000prereq.t                                |  24 +-
 t/01version.t                                |  22 +-
 t/02zlib.t                                   |  15 +-
 t/07bufsize.t                                |  12 +-
 t/09limitoutput.t                            |   5 +-
 t/18lvalue.t                                 |  11 +-
 t/19nonpv.t                                  |   9 +-
 t/99pod.t                                    |   1 -
 t/compress/CompTestUtils.pm                  |  41 ++++
 15 files changed, 437 insertions(+), 210 deletions(-)
 create mode 100644 .github/workflows/linux-upstream-zlib-ng.yml

@atheurer
Copy link
Author

@atheurer
Copy link
Author

This line

push @names, { name => 'Z_NULL', type => 'PV' };
seems to trigger this problem.

@pmqs
Copy link
Owner

pmqs commented Jun 26, 2022

Thanks for the bug report @atheurer

Issue reproduced with

perl -MCompress::Raw::Zlib -e 'Compress::Raw::Zlib::Z_NULL'

Actual test failure (in IO::Compress): https://github.com/pmqs/IO-Compress/blob/bc3e8dd1023425e27187624ff8f2b6539b28ee23/t/111const-deflate.t#L31

Are you seeing this test fail? If so, can you share the output from running perl -V please along with th ename of the OS you are using please?

@pmqs pmqs self-assigned this Jun 26, 2022
@pmqs pmqs added the bug Something isn't working label Jun 26, 2022
@pmqs pmqs changed the title Segfault with '{ use Compress::Raw::Zlib ; eval "defined Compress::Raw::Zlib::Z_NULL" ; }' Segfault with Compress::Raw::Zlib::Z_NULL Jun 26, 2022
@pmqs
Copy link
Owner

pmqs commented Jun 26, 2022

@atheurer if you get a chance, could you try changing this line in Makefile.PL

    push @names, { name => 'Z_NULL', type => 'PV' };

to this

    push @names, { name => 'Z_NULL', type => 'UV' };

Does that still core for you? It fixes the issue for me.

pmqs added a commit that referenced this issue Jun 26, 2022
@atheurer
Copy link
Author

Yes, that fixes the issue for me, thanks.

@pmqs pmqs closed this as completed Jun 27, 2022
pmqs added a commit to pmqs/IO-Compress that referenced this issue Jul 2, 2022
atoomic added a commit to atoomic/perl5 that referenced this issue Jul 20, 2022
From ChangeLog:

  2.202 27 June 2022

      * Z_NULL should be 'UV' rather than 'PV'
        pmqs/Compress-Raw-Zlib#17
        Sun Jun 26 22:02:04 2022 +0100
        de28f0335d3d605d696b19d43fc48de42272455c

  2.201 25 June 2022

      * 2.021
        Sat Jun 25 08:42:46 2022 +0100
        85416cab509c18c5fa3f923de7b45b6c7c0f7a6f

      * 2.201
        Sat Jun 25 08:39:26 2022 +0100
        b3d63862b2ff4ac9d28e23be500c0d32ad69dd11

      * More zlib-ng updates
        Thu Jun 23 22:42:13 2022 +0100
        313f626425181702b5fc80af2b6ea7eed41d5a9d

      * Fix test count regression in t/07bufsize.t (Perl#16)
        Wed Jun 22 09:45:11 2022 +0100
        98dc5b4a2b30c26752b6f686462b06b8db72a5e4

  2.200 21 June 2022

      * Added zlib-ng support
        pmqs/Compress-Raw-Zlib#9

      * Only set Z_SOLO when building zlib sources
      * pmqs/Compress-Raw-Zlib#12
        Tue Jun 7 10:13:00 2022 +0100
        c44e0b732e214b7f77d42a3af6ae64ef944cee90

  2.105 14 April 2022

      * Add Compress::Raw::Zlib::VERSION to output
        Sat May 14 15:16:57 2022 +0100
        3e22c93169a67986017f64d9a2e5085c417d8624

      * Dump version info when running test harness
        Sat May 14 15:10:17 2022 +0100
        ca9f33ba0323d0abc91a83800636f180b2b44162

      * Fix use of ZLIB_INCLUDE/LIB
        Sat May 14 09:01:38 2022 +0100
        8a7d4a97d7441b61a8a888342766419044fa5a33

      * More fixes for BUILD_ZLIB off
        Sat May 14 08:54:04 2022 +0100
        2d9650094dab90858ef58bfbda62f3bc60e159e4

      * Add BUILD_ZLIB to the matrix
        Sat May 14 08:31:54 2022 +0100
        b61b92fc9d06bf04f1adec337357ffbd39535901

      * Merge branch 'master' of
      * https://github.com/pmqs/Compress-Raw-Zlib
        Sat May 14 08:27:14 2022 +0100
        3ac7d0d3d45ae263402fab1ebb3835e2ae16c5a6

      * Fix for BUILD_ZLIB disabled
        Sat May 14 08:25:34 2022 +0100
        b0f04e37fb58a34ef01767ad16a8f63ca868eec6

      * Add BUILD_ZLIB to the matrix
        Sat May 14 08:22:56 2022 +0100
        aa8f5ff981c7305c995d4e2f798ae0d7d45866a5

  2.104 13 April 2022

      * Merge pull request #11 from monkburger/symbol_fix_2
        Fri May 13 07:17:19 2022 +0100
        64aea2d3f78946d7df4096eadfa0d7267f4439a5

      * perl_crz -> Perl_crz
        Tue May 3 18:19:24 2022 +0000
        20502e6c2eba8ddcad80b20574e840457c0cb369

      * This is a slightly different way to fix
      * pmqs/Compress-Raw-Zlib#8
        Tue May 3 18:06:48 2022 +0000
        d9cd27fb212da7455b6ba44729ca11bb441f3950

      * add tests for crc32/adler32_combine
        Mon May 2 16:18:13 2022 +0100
        dcfe9ef439790f1a4fae81cf3eac38cfeb848294
atoomic added a commit to Perl/perl5 that referenced this issue Jul 20, 2022
From ChangeLog:

  2.202 27 June 2022

      * Z_NULL should be 'UV' rather than 'PV'
        pmqs/Compress-Raw-Zlib#17
        Sun Jun 26 22:02:04 2022 +0100
        de28f0335d3d605d696b19d43fc48de42272455c

  2.201 25 June 2022

      * 2.021
        Sat Jun 25 08:42:46 2022 +0100
        85416cab509c18c5fa3f923de7b45b6c7c0f7a6f

      * 2.201
        Sat Jun 25 08:39:26 2022 +0100
        b3d63862b2ff4ac9d28e23be500c0d32ad69dd11

      * More zlib-ng updates
        Thu Jun 23 22:42:13 2022 +0100
        313f626425181702b5fc80af2b6ea7eed41d5a9d

      * Fix test count regression in t/07bufsize.t (#16)
        Wed Jun 22 09:45:11 2022 +0100
        98dc5b4a2b30c26752b6f686462b06b8db72a5e4

  2.200 21 June 2022

      * Added zlib-ng support
        pmqs/Compress-Raw-Zlib#9

      * Only set Z_SOLO when building zlib sources
      * pmqs/Compress-Raw-Zlib#12
        Tue Jun 7 10:13:00 2022 +0100
        c44e0b732e214b7f77d42a3af6ae64ef944cee90

  2.105 14 April 2022

      * Add Compress::Raw::Zlib::VERSION to output
        Sat May 14 15:16:57 2022 +0100
        3e22c93169a67986017f64d9a2e5085c417d8624

      * Dump version info when running test harness
        Sat May 14 15:10:17 2022 +0100
        ca9f33ba0323d0abc91a83800636f180b2b44162

      * Fix use of ZLIB_INCLUDE/LIB
        Sat May 14 09:01:38 2022 +0100
        8a7d4a97d7441b61a8a888342766419044fa5a33

      * More fixes for BUILD_ZLIB off
        Sat May 14 08:54:04 2022 +0100
        2d9650094dab90858ef58bfbda62f3bc60e159e4

      * Add BUILD_ZLIB to the matrix
        Sat May 14 08:31:54 2022 +0100
        b61b92fc9d06bf04f1adec337357ffbd39535901

      * Merge branch 'master' of
      * https://github.com/pmqs/Compress-Raw-Zlib
        Sat May 14 08:27:14 2022 +0100
        3ac7d0d3d45ae263402fab1ebb3835e2ae16c5a6

      * Fix for BUILD_ZLIB disabled
        Sat May 14 08:25:34 2022 +0100
        b0f04e37fb58a34ef01767ad16a8f63ca868eec6

      * Add BUILD_ZLIB to the matrix
        Sat May 14 08:22:56 2022 +0100
        aa8f5ff981c7305c995d4e2f798ae0d7d45866a5

  2.104 13 April 2022

      * Merge pull request #11 from monkburger/symbol_fix_2
        Fri May 13 07:17:19 2022 +0100
        64aea2d3f78946d7df4096eadfa0d7267f4439a5

      * perl_crz -> Perl_crz
        Tue May 3 18:19:24 2022 +0000
        20502e6c2eba8ddcad80b20574e840457c0cb369

      * This is a slightly different way to fix
      * pmqs/Compress-Raw-Zlib#8
        Tue May 3 18:06:48 2022 +0000
        d9cd27fb212da7455b6ba44729ca11bb441f3950

      * add tests for crc32/adler32_combine
        Mon May 2 16:18:13 2022 +0100
        dcfe9ef439790f1a4fae81cf3eac38cfeb848294
scottchiefbaker pushed a commit to scottchiefbaker/perl5 that referenced this issue Nov 3, 2022
From ChangeLog:

  2.202 27 June 2022

      * Z_NULL should be 'UV' rather than 'PV'
        pmqs/Compress-Raw-Zlib#17
        Sun Jun 26 22:02:04 2022 +0100
        de28f0335d3d605d696b19d43fc48de42272455c

  2.201 25 June 2022

      * 2.021
        Sat Jun 25 08:42:46 2022 +0100
        85416cab509c18c5fa3f923de7b45b6c7c0f7a6f

      * 2.201
        Sat Jun 25 08:39:26 2022 +0100
        b3d63862b2ff4ac9d28e23be500c0d32ad69dd11

      * More zlib-ng updates
        Thu Jun 23 22:42:13 2022 +0100
        313f626425181702b5fc80af2b6ea7eed41d5a9d

      * Fix test count regression in t/07bufsize.t (Perl#16)
        Wed Jun 22 09:45:11 2022 +0100
        98dc5b4a2b30c26752b6f686462b06b8db72a5e4

  2.200 21 June 2022

      * Added zlib-ng support
        pmqs/Compress-Raw-Zlib#9

      * Only set Z_SOLO when building zlib sources
      * pmqs/Compress-Raw-Zlib#12
        Tue Jun 7 10:13:00 2022 +0100
        c44e0b732e214b7f77d42a3af6ae64ef944cee90

  2.105 14 April 2022

      * Add Compress::Raw::Zlib::VERSION to output
        Sat May 14 15:16:57 2022 +0100
        3e22c93169a67986017f64d9a2e5085c417d8624

      * Dump version info when running test harness
        Sat May 14 15:10:17 2022 +0100
        ca9f33ba0323d0abc91a83800636f180b2b44162

      * Fix use of ZLIB_INCLUDE/LIB
        Sat May 14 09:01:38 2022 +0100
        8a7d4a97d7441b61a8a888342766419044fa5a33

      * More fixes for BUILD_ZLIB off
        Sat May 14 08:54:04 2022 +0100
        2d9650094dab90858ef58bfbda62f3bc60e159e4

      * Add BUILD_ZLIB to the matrix
        Sat May 14 08:31:54 2022 +0100
        b61b92fc9d06bf04f1adec337357ffbd39535901

      * Merge branch 'master' of
      * https://github.com/pmqs/Compress-Raw-Zlib
        Sat May 14 08:27:14 2022 +0100
        3ac7d0d3d45ae263402fab1ebb3835e2ae16c5a6

      * Fix for BUILD_ZLIB disabled
        Sat May 14 08:25:34 2022 +0100
        b0f04e37fb58a34ef01767ad16a8f63ca868eec6

      * Add BUILD_ZLIB to the matrix
        Sat May 14 08:22:56 2022 +0100
        aa8f5ff981c7305c995d4e2f798ae0d7d45866a5

  2.104 13 April 2022

      * Merge pull request Perl#11 from monkburger/symbol_fix_2
        Fri May 13 07:17:19 2022 +0100
        64aea2d3f78946d7df4096eadfa0d7267f4439a5

      * perl_crz -> Perl_crz
        Tue May 3 18:19:24 2022 +0000
        20502e6c2eba8ddcad80b20574e840457c0cb369

      * This is a slightly different way to fix
      * pmqs/Compress-Raw-Zlib#8
        Tue May 3 18:06:48 2022 +0000
        d9cd27fb212da7455b6ba44729ca11bb441f3950

      * add tests for crc32/adler32_combine
        Mon May 2 16:18:13 2022 +0100
        dcfe9ef439790f1a4fae81cf3eac38cfeb848294
jkeenan pushed a commit to Perl/perl5 that referenced this issue Feb 15, 2023
kraj pushed a commit to YoeDistro/meta-openembedded that referenced this issue Mar 24, 2023
Changelog:
==========
* Update Gzip.pm
   pmqs/IO-Compress#49
   6d0514b86ceeab56884c43fd1e6f09f839c12b74
   feab074420bf4059eb6fa9d0553a354e2dd33e95

 * Allow Z_NULL
   pmqs/Compress-Raw-Zlib#17
   c42da1483767bc8afbdb2d8b03ecda7b67b4d022

License-Update: Copyright year updated to 2023.

Signed-off-by: Wang Mingyu <wangmy@fujitsu.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
pjacklam pushed a commit to pjacklam/perl5 that referenced this issue May 20, 2023
pjacklam pushed a commit to pjacklam/perl5 that referenced this issue May 20, 2023
khwilliamson pushed a commit to khwilliamson/perl5 that referenced this issue Jul 10, 2023
daregit pushed a commit to daregit/yocto-combined that referenced this issue May 22, 2024
Changelog:
==========
* Update Gzip.pm
   pmqs/IO-Compress#49
   6d0514b86ceeab56884c43fd1e6f09f839c12b74
   feab074420bf4059eb6fa9d0553a354e2dd33e95

 * Allow Z_NULL
   pmqs/Compress-Raw-Zlib#17
   c42da1483767bc8afbdb2d8b03ecda7b67b4d022

License-Update: Copyright year updated to 2023.

Signed-off-by: Wang Mingyu <wangmy@fujitsu.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants