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

mini_ssl.c - fix TruffleRuby compile error #3289

Merged
merged 1 commit into from
Dec 10, 2023

Conversation

MSP-Greg
Copy link
Member

Description

Fixes:

compiling ../../../../ext/puma_http11/mini_ssl.c
../../../../ext/puma_http11/mini_ssl.c: In function ‘raise_error’:
../../../../ext/puma_http11/mini_ssl.c:569:50: error: ‘%s’ directive output may be truncated writing up to 511 bytes into a region of size 497 [-Werror=format-truncation=]
  569 |       snprintf(msg, sizeof(msg), "OpenSSL error: %s - %d", buf, err & mask);
      |                                                  ^~        ~~~
../../../../ext/puma_http11/mini_ssl.c:569:34: note: directive argument in the range [0, 4095]
  569 |       snprintf(msg, sizeof(msg), "OpenSSL error: %s - %d", buf, err & mask);
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/stdio.h:867,
                 from /home/runner/.rubies/truffleruby-head/lib/cext/include/ruby/defines.h:16,
                 from /home/runner/.rubies/truffleruby-head/lib/cext/include/truffleruby/truffleruby-pre.h:[38](https://github.com/MSP-Greg/puma/actions/runs/7160290330/job/19494508272#step:7:39),
                 from /home/runner/.rubies/truffleruby-head/lib/cext/include/ruby/internal/config.h:164,
                 from /home/runner/.rubies/truffleruby-head/lib/cext/include/ruby/ruby.h:15,
                 from /home/runner/.rubies/truffleruby-head/lib/cext/include/ruby.h:38,
                 from ../../../../ext/puma_http11/mini_ssl.c:3:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:67:10: note: ‘__builtin___snprintf_chk’ output between 20 and 534 bytes into a destination of size [51](https://github.com/MSP-Greg/puma/actions/runs/7160290330/job/19494508272#step:7:52)2
   67 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   68 |        __bos (__s), __fmt, __va_arg_pack ());
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make: *** [Makefile:[56](https://github.com/MSP-Greg/puma/actions/runs/7160290330/job/19494508272#step:7:57)6: mini_ssl.o] Error 1

Your checklist for this pull request

  • I have reviewed the guidelines for contributing to this repository.
  • I have added (or updated) appropriate tests if this PR fixes a bug or adds a feature.
  • My pull request is 100 lines added/removed or less so that it can be easily reviewed.
  • If this PR doesn't need tests (docs change), I added [ci skip] to the title of the PR.
  • If this closes any issues, I have added "Closes #issue" to the PR description or my commit messages.
  • I have updated the documentation accordingly.
  • All new and existing tests passed, including Rubocop.

@dentarg
Copy link
Member

dentarg commented Dec 10, 2023

Something changed in a recent version of TruffleRuby?

@MSP-Greg
Copy link
Member Author

MSP-Greg commented Dec 10, 2023

Something changed in a recent version of TruffleRuby?

Haven't looked. Could be updates to compiler warnings in TruffleRuby, or an update to the compiler. Regardless, having a buffer that's x size, adding additional text, and expecting it to always fit in another buffer the same size is understandably a possible issue.

@MSP-Greg MSP-Greg merged commit c1ae884 into puma:master Dec 10, 2023
59 of 64 checks passed
@MSP-Greg MSP-Greg deleted the 00-fix-compile branch December 10, 2023 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants