Skip to content

Commit cbe4df5

Browse files
committed
Merge branch 'maint'
2 parents 1ede209 + 17640d7 commit cbe4df5

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

erts/emulator/beam/erl_bif_re.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,6 @@ build_compile_result(Process *p, pcre2_code *result, byte unicode, bool with_ok)
583583
{
584584
Eterm *hp;
585585
Eterm ret;
586-
size_t pattern_size;
587586
uint32_t capture_count;
588587
uint32_t newline;
589588
int use_crlf;
@@ -593,7 +592,6 @@ build_compile_result(Process *p, pcre2_code *result, byte unicode, bool with_ok)
593592

594593
ASSERT(result);
595594

596-
pcre2_pattern_info(result, PCRE2_INFO_SIZE, &pattern_size);
597595
pcre2_pattern_info(result, PCRE2_INFO_CAPTURECOUNT, &capture_count);
598596
pcre2_pattern_info(result, PCRE2_INFO_NEWLINE, &newline);
599597
use_crlf = (newline == PCRE2_NEWLINE_ANY ||
@@ -716,6 +714,9 @@ re_import_1(BIF_ALIST_1)
716714
byte enc_ver;
717715
byte unicode;
718716

717+
ERTS_UNDEF(regex_code, NULL);
718+
ERTS_UNDEF(unicode, 0);
719+
719720
// {re_exported_pattern, HeaderBin, OrigBin, OrigOpts, EncodedBin}
720721

721722
if (!is_tuple_arity(BIF_ARG_1, 5)) {
@@ -736,9 +737,14 @@ re_import_1(BIF_ALIST_1)
736737
const byte *encoded;
737738
Uint encoded_sz;
738739

739-
if (hdr_sz != EXPORTED_HDR_SZ) {
740+
/*
741+
* Allow header to contain more unknow data that we ignore.
742+
* Could be new optional features (such as checksum over fallback)
743+
* that was added while being forward compatible.
744+
*/
745+
/*if (hdr_sz != EXPORTED_HDR_SZ) {
740746
goto badarg;
741-
}
747+
}*/
742748

743749
encoded = erts_get_aligned_binary_bytes(tpl[5], &encoded_sz,
744750
&encoded_tmp_alloc);
@@ -897,6 +903,8 @@ re_compile(Process* p, Eterm re_arg, Eterm opts_arg, bool is_import)
897903
Eterm regex_bin;
898904
Eterm* regex_bin_p;
899905

906+
ERTS_UNDEF(regex_bin, THE_NON_VALUE);
907+
900908
if (!parse_options(opts_arg, &opts)) {
901909
opt_error:
902910
p->fvalue = am_badopt;

0 commit comments

Comments
 (0)