diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 0b4103913bcae5..3ac1ed59cb2b5f 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -75,17 +75,17 @@ jobs: run: sudo rm /usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb - name: Initialize CodeQL - uses: github/codeql-action/init@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3.27.9 + uses: github/codeql-action/init@e296a935590eb16afc0c0108289f68c87e2a89a5 # v4.30.7 with: languages: ${{ matrix.language }} trap-caching: false debug: true - name: Autobuild - uses: github/codeql-action/autobuild@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3.27.9 + uses: github/codeql-action/autobuild@e296a935590eb16afc0c0108289f68c87e2a89a5 # v4.30.7 - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3.27.9 + uses: github/codeql-action/analyze@e296a935590eb16afc0c0108289f68c87e2a89a5 # v4.30.7 with: category: '/language:${{ matrix.language }}' upload: False @@ -115,7 +115,7 @@ jobs: continue-on-error: true - name: Upload SARIF - uses: github/codeql-action/upload-sarif@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3.27.9 + uses: github/codeql-action/upload-sarif@e296a935590eb16afc0c0108289f68c87e2a89a5 # v4.30.7 with: sarif_file: sarif-results/${{ matrix.language }}.sarif continue-on-error: true diff --git a/.github/workflows/post_push.yml b/.github/workflows/post_push.yml index e252239c3fbf4e..32d74f644e6bf0 100644 --- a/.github/workflows/post_push.yml +++ b/.github/workflows/post_push.yml @@ -22,6 +22,13 @@ jobs: RUBY_GIT_SYNC_PRIVATE_KEY: ${{ secrets.RUBY_GIT_SYNC_PRIVATE_KEY }} if: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/ruby_') }} + - name: Fetch changesets on bugs.ruby-lang.org + run: | + curl "https://bugs.ruby-lang.org/sys/fetch_changesets?key=${REDMINE_SYS_API_KEY}" -s --fail-with-body -w '* status: %{http_code}\n' + env: + REDMINE_SYS_API_KEY: ${{ secrets.REDMINE_SYS_API_KEY }} + if: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/ruby_') }} + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: fetch-depth: 500 # for notify-slack-commits diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml index 99c563a25b3728..34a301ddb020d5 100644 --- a/.github/workflows/scorecards.yml +++ b/.github/workflows/scorecards.yml @@ -73,6 +73,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard (optional). # Commenting out will disable upload of results to your repo's Code Scanning dashboard - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@v3 + uses: github/codeql-action/upload-sarif@v4 with: sarif_file: results.sarif diff --git a/error.c b/error.c index c510432c9d8ae4..2f24929d44ea91 100644 --- a/error.c +++ b/error.c @@ -2619,7 +2619,7 @@ name_err_mesg_to_str(VALUE obj) VALUE mesg = ptr->mesg; if (NIL_P(mesg)) return Qnil; else { - struct RString s_str, c_str, d_str; + struct RString s_str = {RBASIC_INIT}, c_str = {RBASIC_INIT}, d_str = {RBASIC_INIT}; VALUE c, s, d = 0, args[4], c2; int state = 0; rb_encoding *usascii = rb_usascii_encoding(); diff --git a/ext/-test-/string/fstring.c b/ext/-test-/string/fstring.c index 71c4b7f97eee44..92a846a93c2e5c 100644 --- a/ext/-test-/string/fstring.c +++ b/ext/-test-/string/fstring.c @@ -12,7 +12,7 @@ VALUE bug_s_fstring_fake_str(VALUE self) { static const char literal[] = "abcdefghijklmnopqrstuvwxyz"; - struct RString fake_str; + struct RString fake_str = {RBASIC_INIT}; return rb_str_to_interned_str(rb_setup_fake_str(&fake_str, literal, sizeof(literal) - 1, 0)); } diff --git a/include/ruby/internal/attr/nonstring.h b/include/ruby/internal/attr/nonstring.h index 9a66180e19e2d2..5ad6ef2a86507e 100644 --- a/include/ruby/internal/attr/nonstring.h +++ b/include/ruby/internal/attr/nonstring.h @@ -27,6 +27,8 @@ # define RBIMPL_ATTR_NONSTRING() __attribute__((nonstring)) # if RBIMPL_COMPILER_SINCE(GCC, 15, 0, 0) # define RBIMPL_ATTR_NONSTRING_ARRAY() RBIMPL_ATTR_NONSTRING() +# elif RBIMPL_COMPILER_SINCE(Clang, 21, 0, 0) +# define RBIMPL_ATTR_NONSTRING_ARRAY() RBIMPL_ATTR_NONSTRING() # else # define RBIMPL_ATTR_NONSTRING_ARRAY() /* void */ # endif diff --git a/include/ruby/internal/core/rbasic.h b/include/ruby/internal/core/rbasic.h index 35af03f7c807e3..63cdff8e09586c 100644 --- a/include/ruby/internal/core/rbasic.h +++ b/include/ruby/internal/core/rbasic.h @@ -115,6 +115,9 @@ RBasic { #endif { } +# define RBASIC_INIT RBasic() +#else +# define RBASIC_INIT {RBIMPL_VALUE_NULL} #endif }; diff --git a/include/ruby/internal/core/rstring.h b/include/ruby/internal/core/rstring.h index 0bca74e688fe44..9cf9daa97c87e7 100644 --- a/include/ruby/internal/core/rstring.h +++ b/include/ruby/internal/core/rstring.h @@ -395,7 +395,7 @@ rbimpl_rstring_getmem(VALUE str) } else { /* Expecting compilers to optimize this on-stack struct away. */ - struct RString retval; + struct RString retval = {RBASIC_INIT}; retval.len = RSTRING_LEN(str); retval.as.heap.ptr = RSTRING(str)->as.embed.ary; return retval; diff --git a/load.c b/load.c index 1928721c9e9cb2..9a1ff53f5415da 100644 --- a/load.c +++ b/load.c @@ -1434,7 +1434,7 @@ rb_require_internal(VALUE fname) int ruby_require_internal(const char *fname, unsigned int len) { - struct RString fake; + struct RString fake = {RBASIC_INIT}; VALUE str = rb_setup_fake_str(&fake, fname, len, 0); rb_execution_context_t *ec = GET_EC(); int result = require_internal(ec, str, 0, RTEST(ruby_verbose)); @@ -1476,7 +1476,7 @@ rb_require_string_internal(VALUE fname, bool resurrect) VALUE rb_require(const char *fname) { - struct RString fake; + struct RString fake = {RBASIC_INIT}; VALUE str = rb_setup_fake_str(&fake, fname, strlen(fname), 0); return rb_require_string_internal(str, true); } diff --git a/marshal.c b/marshal.c index f7474ca60edf07..4372960a7190ef 100644 --- a/marshal.c +++ b/marshal.c @@ -1428,7 +1428,7 @@ long ruby_marshal_read_long(const char **buf, long len) { long x; - struct RString src; + struct RString src = {RBASIC_INIT}; struct load_arg arg; memset(&arg, 0, sizeof(arg)); arg.src = rb_setup_fake_str(&src, *buf, len, 0); diff --git a/string.c b/string.c index a31aaece18f7a1..331f48313600f4 100644 --- a/string.c +++ b/string.c @@ -655,14 +655,14 @@ rb_setup_fake_str(struct RString *fake_str, const char *name, long len, rb_encod VALUE rb_fstring_new(const char *ptr, long len) { - struct RString fake_str; + struct RString fake_str = {RBASIC_INIT}; return register_fstring(setup_fake_str(&fake_str, ptr, len, ENCINDEX_US_ASCII), false, false); } VALUE rb_fstring_enc_new(const char *ptr, long len, rb_encoding *enc) { - struct RString fake_str; + struct RString fake_str = {RBASIC_INIT}; return register_fstring(rb_setup_fake_str(&fake_str, ptr, len, enc), false, false); } @@ -6497,7 +6497,7 @@ str_gsub(int argc, VALUE *argv, VALUE str, int bang) val = rb_obj_as_string(rb_yield(match0)); } else { - struct RString fake_str; + struct RString fake_str = {RBASIC_INIT}; VALUE key; if (mode == FAST_MAP) { // It is safe to use a fake_str here because we established that it won't escape, @@ -12747,7 +12747,7 @@ rb_str_to_interned_str(VALUE str) VALUE rb_interned_str(const char *ptr, long len) { - struct RString fake_str; + struct RString fake_str = {RBASIC_INIT}; return register_fstring(setup_fake_str(&fake_str, ptr, len, ENCINDEX_US_ASCII), true, false); } @@ -12764,7 +12764,7 @@ rb_enc_interned_str(const char *ptr, long len, rb_encoding *enc) rb_enc_autoload(enc); } - struct RString fake_str; + struct RString fake_str = {RBASIC_INIT}; return register_fstring(rb_setup_fake_str(&fake_str, ptr, len, enc), true, false); } @@ -12775,7 +12775,7 @@ rb_enc_literal_str(const char *ptr, long len, rb_encoding *enc) rb_enc_autoload(enc); } - struct RString fake_str; + struct RString fake_str = {RBASIC_INIT}; return register_fstring(rb_setup_fake_str(&fake_str, ptr, len, enc), true, true); } diff --git a/symbol.c b/symbol.c index e8eacd34c2b4b8..a498f742aa1600 100644 --- a/symbol.c +++ b/symbol.c @@ -845,7 +845,7 @@ lookup_id_str(ID id) ID rb_intern3(const char *name, long len, rb_encoding *enc) { - struct RString fake_str; + struct RString fake_str = {RBASIC_INIT}; VALUE str = rb_setup_fake_str(&fake_str, name, len, enc); OBJ_FREEZE(str); @@ -1222,7 +1222,7 @@ rb_check_symbol(volatile VALUE *namep) ID rb_check_id_cstr(const char *ptr, long len, rb_encoding *enc) { - struct RString fake_str; + struct RString fake_str = {RBASIC_INIT}; const VALUE name = rb_setup_fake_str(&fake_str, ptr, len, enc); sym_check_asciionly(name, true); @@ -1234,7 +1234,7 @@ VALUE rb_check_symbol_cstr(const char *ptr, long len, rb_encoding *enc) { VALUE sym; - struct RString fake_str; + struct RString fake_str = {RBASIC_INIT}; const VALUE name = rb_setup_fake_str(&fake_str, ptr, len, enc); sym_check_asciionly(name, true); @@ -1258,7 +1258,7 @@ FUNC_MINIMIZED(VALUE rb_sym_intern_ascii_cstr(const char *ptr)); VALUE rb_sym_intern(const char *ptr, long len, rb_encoding *enc) { - struct RString fake_str; + struct RString fake_str = {RBASIC_INIT}; const VALUE name = rb_setup_fake_str(&fake_str, ptr, len, enc); return rb_str_intern(name); } diff --git a/vm_insnhelper.c b/vm_insnhelper.c index f4f0314ed90ece..b99ffdc4fdbbe6 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -6428,7 +6428,7 @@ static VALUE vm_opt_newarray_include_p(rb_execution_context_t *ec, rb_num_t num, const VALUE *ptr, VALUE target) { if (BASIC_OP_UNREDEFINED_P(BOP_INCLUDE_P, ARRAY_REDEFINED_OP_FLAG)) { - struct RArray fake_ary; + struct RArray fake_ary = {RBASIC_INIT}; VALUE ary = rb_setup_fake_ary(&fake_ary, ptr, num); return rb_ary_includes(ary, target); } @@ -6448,7 +6448,7 @@ static VALUE vm_opt_newarray_pack_buffer(rb_execution_context_t *ec, rb_num_t num, const VALUE *ptr, VALUE fmt, VALUE buffer) { if (BASIC_OP_UNREDEFINED_P(BOP_PACK, ARRAY_REDEFINED_OP_FLAG)) { - struct RArray fake_ary; + struct RArray fake_ary = {RBASIC_INIT}; VALUE ary = rb_setup_fake_ary(&fake_ary, ptr, num); return rb_ec_pack_ary(ec, ary, fmt, (UNDEF_P(buffer) ? Qnil : buffer)); }