-
Notifications
You must be signed in to change notification settings - Fork 3
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
T1 tests fail under Strawberry perl 5.36 and 5.38, gcc13.1 #510
Comments
Is this exactly the same libt1 that shipped with strawberry perl 5.32.1.1? |
It's the same libt1 code but compiled using gcc-13.1. Source is http://www.ibiblio.org/pub/linux/libs/graphics/t1lib-5.1.2.tar.gz Last change to the Strawberry build was four years ago; https://github.com/StrawberryPerl/build-extlibs/blame/master/sources.list#L169 Edit: Build args if relevant: |
Would it be possible to produce a backtrace with symbols in libt1 and in Imager::Font::T1? (it looks like it only has the exports available as symbols for Imager::Font::T1) The two issues you've referenced seem irrelevant:
|
I just rebuilt libt1 with
They were provided given the other gcc-13 issues we'd hit. Probably not surprising they seem not relevant. |
I did some testing with 20230705 with the built t1lib from 20230626 and reproduced it locally. This means I don't have debug info for that file either, and I don't have the tooling setup you're using to build t1lib, but I did build Imager with debug symbols. The crash is happening when T1_LoadFont() is called and the name of the font metrics file has been set, and currently that's always set (and the tests also test setting the font metrics file name.) From looking at t1lib.log it appears to happen somewhere after line 533 in t1load.c, since the last thing logged is:
I couldn't find a suspect strncpy() for this case, though it's possible the lack of debug info for msvcrt means the identification as strncpy() is wrong. You mentioned supplying |
Adding A build of t1lib using those flags is attached. Thread 1 received signal SIGSEGV, Segmentation fault.
0x00007ffe6f51db93 in strncpy () from C:\Windows\System32\msvcrt.dll
(gdb) bt
#0 0x00007ffe6f51db93 in strncpy () from C
[64bit_t1lib-5.1.2-bin_20230707.zip](https://github.com/tonycoz/imager/files/11979869/64bit_t1lib-5.1.2-bin_20230707.zip)
:\Windows\System32\msvcrt.dll
warning: could not convert 'main' from the host encoding (CP65001) to UTF-32.
This normally should not happen, please file a bug report.
#1 0x00000000612f5d49 in ?? () from C:\strawberry\c\bin\libt1-5__.dll
#2 0x0000000061310947 in ?? () from C:\strawberry\c\bin\libt1-5__.dll
#3 0x00000000613012fc in ?? () from C:\strawberry\c\bin\libt1-5__.dll
#4 0x00007ffe63e54bdb in boot_Imager__Font__T1 ()
from C:\spbuild\msys64\.cpanm\work\1688718128.2480\Imager-1.019\blib\arch\auto\Imager\F
ont\T1\T1.xs.dll
#5 0x00007ffe63e51b59 in ?? ()
from C:\spbuild\msys64\.cpanm\work\1688718128.2480\Imager-1.019\blib\arch\auto\Imager\F
ont\T1\T1.xs.dll
#6 0x00007ffe64e02fec in perl538!Perl_clear_defarray ()
from C:\strawberry\perl\bin\perl538.dll
#7 0x00007ffe64e57932 in perl538!Perl_runops_standard ()
from C:\strawberry\perl\bin\perl538.dll
#8 0x00007ffe64e1363a in perl_run () from C:\strawberry\perl\bin\perl538.dll
#9 0x00007ffe64e66e23 in perl538!RunPerl () from C:\strawberry\perl\bin\perl538.dll
#10 0x00007ff798501340 in ?? ()
#11 0x00007ff798501146 in ?? ()
#12 0x00007ffe70287ac4 in KERNEL32!BaseThreadInitThunk ()
from C:\Windows\System32\kernel32.dll
#13 0x00007ffe72aea351 in ntdll!RtlUserThreadStart () from C:\Windows\SYSTEM32\ntdll.dll
#14 0x0000000000000000 in ?? ()
[64bit_t1lib-5.1.2-bin_20230707.zip](https://github.com/tonycoz/imager/files/11979882/64bit_t1lib-5.1.2-bin_20230707.zip)
[64bit_t1lib-5.1.2-bin_20230707.zip](https://github.com/tonycoz/imager/files/11979892/64bit_t1lib-5.1.2-bin_20230707.zip)
Backtrace stopped: previous frame inner to this frame (corrupt stack?) |
This came up while debugging #510 and prevents one of the tests from crashing, but doesn't fix the underlying problem that that build of t1lib is crashing when an afm filename is supplied.
Are you building 32-bits of strawberry perl too? If so do they exhibit the same problem? I managed an adhoc build of the t1lib dll with debug info and got the following backtrace:
note this matches the other backtraces we've done. The code around the call to strncpy():
and the variables involved:
The cast to (long) is breaking the pointer (from a 64-bit pointer to a 32-bit signed integer and then back), and t1lib contains many casts of pointers to long. I expect the older t1lib was patched to fix this. This isn't a problem on Linux since long is 64-bits there. |
Only 64 bit at this stage.
Thanks for getting that running.
That might be the case, but if so the patches were not uploaded to the git repo. Is this is a case of running the code through sed (or perl) to change the cast? Or am I being needlessly optimistic? |
There might be non-pointer casts to long too, so a simple search and replace won't work. The build had many warnings like:
which I expect reveals most cases of these problems. While fixing these are good, I know Debian (used too) and other Linux distributions (I think at least archlinux) also include security fixes for t1lib which fix various potential security issues, though I haven't looked at them in detail. Debian dropped t1lib since there was no upstream maintainer, You can build Imager without t1lib by supplying |
From the link it looks like Debian dropped support about a decade ago. Adobe has also EOL'd support for T1 fonts as of January this year. Strawberry Perl can follow suit, and this issue can be closed. Thanks for digging into the code and identifying the root cause of the issue. |
Note that you still have Type 1 font support through freetype2. |
Installing Imager no longer installs Imager::Font::T1 by default. |
- Update from version 1.012 (2020) to 1.024 - Update of rootfile - Addition of patch to fix inclusion of t1tables.h for FT_Has_PS_Glyph_Names which is no longer pulled in by ftmm.h since FreeType 2.13.3 - Changelog 1.024 - TIFF: improve reporting from a test on failure. - TIFF: support back to libtiff 4.0.8, for compatibility with RHEL and its clones. tonycoz/imager#527 1.023 - TIFF: don't read after free when looking up a compression codec by the libtiff defined name, tonycoz/imager#524 1.022 - TIFF: We can no longer be lazy in implementing the size callback. tonycoz/imager#522 https://bugs.debian.org/1057270 1.021 Several TIFF changes: - require libtiff 4.1.0 or later - add buildversion, builddate and libversion methods - add the codecs method which fetches a list of available TIFF compression codes - avoid deprecation warnings from libtiff about using the old libtiff defined integer types - require vsnprintf() (C99) - remove my adaption of TIFFReadRGBATile() since libtiff now provides TIFFReadRGBATileExt() which can do the same thing - use pkg-config to find libtiff if possible - for sufficiently modern libtiff (4.5.0) use TIFFClientOptions to specify the warning and error handlers, this means we no longer need a mutex for 4.5.0 and later. - collect warnings using a buffer chain instead of custom allocation code. - include the "module" name (typically a libtiff function name) when recording libtiff warnings. - add CI to test Imager::File::TIFF against libtiff 4.1.0 through 4.6.0 - other minor fixes Other changes: - prevent CodeQL from complaining about an implicit conversion to unsigned char 1.020 - masked(): disallow negative width/height masked images - masked(): adjust source corners as bottom right relative if they are negative. - masked(): reject image source corners where either co-ordinate is negative after the above adjustment. - Imager::Files: update external image file support modules list - internal test: don't fail on Imager::File::APNG link - disable Imager::Font::T1 and Freetype 1.x fonts by default. Unpatched t1lib simply doesn't work on 64 bit systems, and no-one ships the patched version anymore. tonycoz/imager#510 1.019 - fix palette/transparency table generation when writing paletted PNG images with tranparency. This happened to work for the test case, but the mechanism used to generate the palette order preserved most palette index positions, which hid the problem with actually generating the PLTE and tRNS chunks. tonycoz/imager#499 - added lowish-level read() and write() class methods to Imager::File::PNG, these are mostly intended for Imager::File::APNG, but are documented and usable elsewhere. - document in Imager::Install how to install Imager without any of the bundled-but-also-on-CPAN modules being installed. tonycoz/imager#498 1.018 - skip trying to produce deprecation warnings before perl 5.14, since that doesn't support custom warning categories within a package. This prevents pointless failures on these old versions of perl. 1.017 Bug fix: - fix a one bytes underallocation for Imager::TrimColorList. On older perls this could lead to writing a zero byte one past the end of the allocated block. Documentation: - expand on why you might want to call Imager->preload() and that you probably don't need to. 1.016 Upcoming backward incompatible changes: - deprecate setting/deleting tags by code. If this causes you a problem please open an issue. You can disable the warning produced with: no warnings 'Imager::tagcodes'; - deprecate image channel masks. If this causes you a problem please open an issue. You can disable the warning produced with: no warnings 'Imager::channelmask'; If you use either of these features please let me know. Minor features: - add magic/extension support for AVIF files, see Imager::File::AVIF on CPAN. - treat an unknown extension of two or more characters as a potential file type on write. Bug fixes: - prevent a possible undefined value warning from t/t10jpeg.t - update MANIFEST.SKIPs, update MANIFESTs and improve MANIFEST testing. - TGA: failing to read in the palette of a paletted TGA file would leak memory. - JPEG: supplying invalid values for the new JPEG write tags could leak memory. - PNG: fix validation of Latin1 only tags when writing PNGs. (detected by clang) - matrix_transform: correctly use fabs() instead of abs() on floating point values when deciding whether to divide for a perspective transform. (detected by clang) - fix the i_poly_aa_cfill_m() API macro Cage cleaning: - eliminate IO::File usage from the Imager code base - fix a type error harmlessly ignored by gcc but found by clang - eliminate memory leaks in sub-module Makefile.PL probe test code to allow the probes to succeed under LeakSanitizer. - BMP: fix some otherwise harmless clang warnings - remove some code meant to work around some unspecified old Solaris linker bug. - i_noise: prevent a harmless conversion warning from clang - fountain fill/filter: limit ssample_param to 1000 to simplify code. 1.015 - rename the "virtual" member of i_img to "isvirtual" to allow the API to be used from C++, this may break source compatibility, using the i_img_virtual() accessor is backward compatible. - add cookbook entry to populating an image from raw RGB samples tonycoz/imager#471 - Imager::Probe now puts the existing value of PKG_CONFIG_PATH at the front of the PKG_CONFIG_PATH used when it calls pkg-config. - setup CodeQL workflow and fix detected warnings JPEG updates: - detect libjpeg (of whichever variety) via pkg-config if possible - add specific support for mozjpeg (turn its optimization off by default so tests pass.) - add libjpeg_version(), is_mozjpeg(), is_turbojpeg() and has_arith_coding() methods - add jpeg_compress_profile output tag, which only matters for mozjpeg - the libjpeg_version() method replaces the old Imager::File::JPEG::i_libjpeg_version() function, and the format has changed. - various obscure jpeg output controls: - add support for JPEG arithmetic coding when the supplied libjpeg supports it. Note that not all JPEG decoders can handle arithmetic coded JPEGs. - add support for disabling the JFIF header for JPEG files using the jpeg_jfif tag. - add support for smoothing to eliminate dithering noise (like cjpeg -smooth) using the jpeg_smooth tag. - add support for producing JPEG restart markers (like cjpeg -restart N), using the jpeg_restart tag. - add control over subsample for JPEG (like the cjpeg -sample parameter) using the jpeg_sample tag - added tags for the rest of the MozJPEG API parameters. - add jpeg_tune tag, corresponding to the MozJPEG cjpeg -tune-* options. 1.014 Bug fixes: - fix failed to build on non-threaded perls. tonycoz/imager#472 - when writing a paletted image with an alpha channel to PNG only set the tRNS chunk if the image has transparent colours. With older libpng this could add an erroneous tRNS chunk (or possibly undefined behaviour if I understand the libpng code). tonycoz/imager#459 Features: - Imager::Color and Imager::Color::Float objects can now be created from CSS style rgb(...) strings. tonycoz/imager#463 - added the as_css_rgb() method to both Imager::Color and Imager::Color::Float to format the supplied color as a CSS style rgb() string. tonycoz/imager#463 - Imager::Color and Imager::Color::Float objects can now be created (copied) or set from other Imager::Color or Imager::Color::Float objects. 1.013 - added rgb_difference() method Thanks to Andreas König tonycoz/imager#462 - update ppport.h to prevent a redefinition diagnostic - update bug tracker URLs to point at github tonycoz/imager#466 - update some other bug tracker URLs too. - add the trim() and trim_rect() methods, to trim borders off an image. - add the as_float() method to Imager::Color and the as_8bit() method to Imager::Color::Float to convert between the two types. - update ppport.h to avoid a diagnostic in more modern perls. - add detection for HEIF, JPEG XL and QOI image formats Signed-off-by: Adolf Belka <adolf.belka@ipfire.org> Reviewed-by: Michael Tremer <michael.tremer@ipfire.org> Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
Cross-ref StrawberryPerl/Perl-Dist-Strawberry#108
Imager is failing the T1 tests under Strawberry perl 5.36 and 5.38 RC (both currently in dev release status).
Both are compiled using gcc-13.1.
Test results and gdb backtrace are below.
FWIW, several other issues have arisen with gcc13 that were related to memory alignments (e.g. StrawberryPerl/Perl-Dist-Strawberry#93 (comment)). Perl 5.38 includes related changes and we are patching these onto 5.36. Possibly relevant is that MCE required a different approach.
If you need a build of perl 5.38.0 RC2 to test with then it can be downloaded from https://github.com/StrawberryPerl/Perl-Dist-Strawberry/releases/tag/dev_5.38.0_RC2_20230626_gcc13
gdb backtrace (SP build extracted to a different machine):
The text was updated successfully, but these errors were encountered: