]> granicus.if.org Git - onig/commitdiff
fix #87: Read unknown address in onig_error_code_to_str()
authorK.Kosako <kosako@sofnec.co.jp>
Tue, 10 Apr 2018 00:00:54 +0000 (09:00 +0900)
committerK.Kosako <kosako@sofnec.co.jp>
Tue, 10 Apr 2018 00:00:54 +0000 (09:00 +0900)
src/regcomp.c

index afce4dbb04cb002ab3fac365cfd8e2c1711740cc..45d4acfd061ae579940ff3d7c339128e69025610 100644 (file)
@@ -5979,7 +5979,10 @@ onig_compile(regex_t* reg, const UChar* pattern, const UChar* pattern_end,
 #endif
 
   root = 0;
-  if (IS_NOT_NULL(einfo)) einfo->par = (UChar* )NULL;
+  if (IS_NOT_NULL(einfo)) {
+    einfo->enc = reg->enc;
+    einfo->par = (UChar* )NULL;
+  }
 
 #ifdef ONIG_DEBUG
   print_enc_string(stderr, reg->enc, pattern, pattern_end);
@@ -6124,7 +6127,6 @@ onig_compile(regex_t* reg, const UChar* pattern, const UChar* pattern_end,
  err:
   if (IS_NOT_NULL(scan_env.error)) {
     if (IS_NOT_NULL(einfo)) {
-      einfo->enc     = scan_env.enc;
       einfo->par     = scan_env.error;
       einfo->par_end = scan_env.error_end;
     }