Skip to content

Commit

Permalink
merge from develop
Browse files Browse the repository at this point in the history
  • Loading branch information
kosako committed Nov 7, 2016
2 parents d5e9cc2 + 700bbec commit 8961d8a
Show file tree
Hide file tree
Showing 17 changed files with 286 additions and 41 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 2.8)
project(oniguruma C)

set(PACKAGE onig)
set(PACKAGE_VERSION "6.1.1")
set(PACKAGE_VERSION "6.1.2")

set(USE_COMBINATION_EXPLOSION_CHECK 0)
set(USE_CRNL_AS_LINE_TERMINATOR 0)
Expand Down
10 changes: 9 additions & 1 deletion HISTORY
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
History

2016/11/07: Version 6.1.2

2016/10/25: allow word bound, word begin and word end in look-behind.
2016/10/19: add ONIG_OPTION_CHECK_VALIDITY_OF_STRING option.
2016/10/16: fix use after free node.
2016/10/10: fix memory leaks after parsing regexp error.
2016/09/22: implement many of is_valid_mbc_string().

2016/09/02: Version 6.1.1

2016/08/31: fix segfault /W.?{888}{888}{888}\x00/ (found by libfuzzer)
Expand Down Expand Up @@ -1721,7 +1729,7 @@ History
2003/03/12: [spec] change named backref and subexp call format.
backref: \k<name>, call: \g<name> (thanks akr)
2003/03/11: [inst] add regparse.[ch] in win32/Makefile.
2003/03/11: [bug] if UNALIGNED_WORD_ACCESS isn't set
2003/03/11: [bug] if UNALIGNED_WORD_ACCESS isn't set,
then compile error in unset_addr_list_fix(). (thanks knu)
2003/03/10: [impl] divide regcomp.c to regcomp.c, regparse.c and regparse.h.
2003/03/10: [bug] should handle multi-byte code name in fetch_name().
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ Supported character encodings:
* CP1251: contributed by Byte


New feature of version 6.1.2
--------------------------

* allow word bound, word begin and word end in look-behind.
* NEW option: ONIG_OPTION_CHECK_VALIDITY_OF_STRING

New feature of version 6.1
--------------------------

Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(onig, 6.1.1)
AC_INIT(onig, 6.1.2)

AC_CONFIG_MACRO_DIR([m4])

Expand Down
2 changes: 1 addition & 1 deletion dist.info
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
--- This file is part of LuaDist project

name = "onig"
version = "6.1.1"
version = "6.1.2"

desc = "Oniguruma is a regular expressions library."
author = "K.Kosako"
Expand Down
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
<h1>Oniguruma</h1> (<a href="index_ja.html">Japanese</a>)

<p>
(c) K.Kosako, updated at: 2016/08/31
(c) K.Kosako, updated at: 2016/11/07
</p>

<dl>
<font color="orange">
<dt><b>What's new</b>
</font>
<ul>
<li>2016/11/07: Version 6.1.2 released.</li>
<li>2016/09/02: Version 6.1.1 released.</li>
<li>2016/08/29: Version 6.1.0 released.</li>
<li>2016/05/09: Version 6.0.0 released.</li>
<li>2014/12/12: Version 5.9.6 released.</li>
</ul>
</dl>
Expand Down
4 changes: 2 additions & 2 deletions index_ja.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
<h1>鬼車</h1>

<p>
(c) K.Kosako, 最終更新: 2016/08/31
(c) K.Kosako, 最終更新: 2016/11/07
</p>

<dl>
<font color="orange">
<dt><b>更新情報</b>
</font>
<ul>
<li>2016/11/07: Version 6.1.2 リリース</li>
<li>2016/09/02: Version 6.1.1 リリース</li>
<li>2016/08/29: Version 6.1.0 リリース</li>
<li>2016/05/09: Version 6.0.0 リリース</li>
<li>2014/12/12: Version 5.9.6 リリース</li>
</ul>
</dl>
Expand Down
23 changes: 21 additions & 2 deletions src/big5.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,28 @@ big5_mbc_enc_len(const UChar* p)
}

static int
is_valid_mbc_string(const UChar* s, const UChar* end)
is_valid_mbc_string(const UChar* p, const UChar* end)
{
return onigenc_length_check_is_valid_mbc_string(ONIG_ENCODING_BIG5, s, end);
while (p < end) {
if (*p < 0x80) {
p++;
}
else if (*p < 0xa1) {
return FALSE;
}
else if (*p < 0xff) {
p++;
if (p >= end) return FALSE;
if (*p < 0x40) return FALSE;
if (*p > 0x7e && *p < 0xa1) return FALSE;
if (*p == 0xff) return FALSE;
p++;
}
else
return FALSE;
}

return TRUE;
}

static OnigCodePoint
Expand Down
34 changes: 32 additions & 2 deletions src/euc_jp.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,39 @@ mbc_enc_len(const UChar* p)
}

static int
is_valid_mbc_string(const UChar* s, const UChar* end)
is_valid_mbc_string(const UChar* p, const UChar* end)
{
return onigenc_length_check_is_valid_mbc_string(ONIG_ENCODING_EUC_JP, s, end);
while (p < end) {
if (*p < 0x80) {
p++;
}
else if (*p > 0xa0) {
if (*p == 0xff) return FALSE;
p++;
if (p >= end) return FALSE;
if (*p < 0xa1 || *p == 0xff) return FALSE;
p++;
}
else if (*p == 0x8e) {
p++;
if (p >= end) return FALSE;
if (*p < 0xa1 || *p > 0xdf) return FALSE;
p++;
}
else if (*p == 0x8f) {
p++;
if (p >= end) return FALSE;
if (*p < 0xa1 || *p == 0xff) return FALSE;
p++;
if (p >= end) return FALSE;
if (*p < 0xa1 || *p == 0xff) return FALSE;
p++;
}
else
return FALSE;
}

return TRUE;
}

static OnigCodePoint
Expand Down
22 changes: 20 additions & 2 deletions src/euc_kr.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,27 @@ euckr_mbc_enc_len(const UChar* p)
}

static int
is_valid_mbc_string(const UChar* s, const UChar* end)
is_valid_mbc_string(const UChar* p, const UChar* end)
{
return onigenc_length_check_is_valid_mbc_string(ONIG_ENCODING_EUC_KR, s, end);
while (p < end) {
if (*p < 0x80) {
p++;
}
else if (*p < 0xa1) {
return FALSE;
}
else if (*p < 0xff) {
p++;
if (p >= end) return FALSE;
if (*p < 0xa1 || *p == 0xff)
return FALSE;
p++;
}
else
return FALSE;
}

return TRUE;
}

static OnigCodePoint
Expand Down
37 changes: 35 additions & 2 deletions src/euc_tw.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,42 @@ euctw_mbc_enc_len(const UChar* p)
}

static int
is_valid_mbc_string(const UChar* s, const UChar* end)
is_valid_mbc_string(const UChar* p, const UChar* end)
{
return onigenc_length_check_is_valid_mbc_string(ONIG_ENCODING_EUC_TW, s, end);
while (p < end) {
if (*p < 0x80) {
p++;
}
else if (*p < 0xa1) {
if (*p == 0x8e) {
p++;
if (p >= end) return FALSE;
if (*p < 0xa1 || *p > 0xb0) return FALSE;
p++;
if (p >= end) return FALSE;
if (*p < 0xa1 || *p == 0xff)
return FALSE;
p++;
if (p >= end) return FALSE;
if (*p < 0xa1 || *p == 0xff)
return FALSE;
p++;
}
else
return FALSE;
}
else if (*p < 0xff) {
p++;
if (p >= end) return FALSE;
if (*p < 0xa1 || *p == 0xff)
return FALSE;
p++;
}
else
return FALSE;
}

return TRUE;
}

static OnigCodePoint
Expand Down
38 changes: 36 additions & 2 deletions src/gb18030.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,43 @@ gb18030_mbc_enc_len(const UChar* p)
}

static int
is_valid_mbc_string(const UChar* s, const UChar* end)
is_valid_mbc_string(const UChar* p, const UChar* end)
{
return onigenc_length_check_is_valid_mbc_string(ONIG_ENCODING_GB18030, s, end);
while (p < end) {
if (*p < 0x80) {
p++;
}
else if (*p == 0x80 || *p == 0xff) {
return FALSE;
}
else {
p++;
if (p >= end) return FALSE;
if (*p < 0x40) {
if (*p < 0x30 || *p > 0x39)
return FALSE;

p++;
if (p >= end) return FALSE;
if (*p < 0x81 || *p == 0xff) return FALSE;

p++;
if (p >= end) return FALSE;
if (*p < 0x30 || *p > 0x39)
return FALSE;

p++;
}
else if (*p == 0x7f || *p == 0xff) {
return FALSE;
}
else {
p++;
}
}
}

return TRUE;
}

static OnigCodePoint
Expand Down
9 changes: 5 additions & 4 deletions src/oniguruma.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ extern "C" {
#define ONIGURUMA
#define ONIGURUMA_VERSION_MAJOR 6
#define ONIGURUMA_VERSION_MINOR 1
#define ONIGURUMA_VERSION_TEENY 1
#define ONIGURUMA_VERSION_TEENY 2

#ifdef __cplusplus
# ifndef HAVE_PROTOTYPES
Expand Down Expand Up @@ -364,7 +364,7 @@ int onigenc_strlen_null P_((OnigEncoding enc, const OnigUChar* p));
ONIG_EXTERN
int onigenc_str_bytelen_null P_((OnigEncoding enc, const OnigUChar* p));
ONIG_EXTERN
int onigenc_is_valid_mbc_string P_((OnigEncoding enc, const UChar* s, const UChar* end));
int onigenc_is_valid_mbc_string P_((OnigEncoding enc, const OnigUChar* s, const OnigUChar* end));



Expand Down Expand Up @@ -398,7 +398,8 @@ typedef unsigned int OnigOptionType;
#define ONIG_OPTION_NOTBOL (ONIG_OPTION_CAPTURE_GROUP << 1)
#define ONIG_OPTION_NOTEOL (ONIG_OPTION_NOTBOL << 1)
#define ONIG_OPTION_POSIX_REGION (ONIG_OPTION_NOTEOL << 1)
#define ONIG_OPTION_MAXBIT ONIG_OPTION_POSIX_REGION /* limit */
#define ONIG_OPTION_CHECK_VALIDITY_OF_STRING (ONIG_OPTION_POSIX_REGION << 1)
#define ONIG_OPTION_MAXBIT ONIG_OPTION_CHECK_VALIDITY_OF_STRING /* limit */

#define ONIG_OPTION_ON(options,regopt) ((options) |= (regopt))
#define ONIG_OPTION_OFF(options,regopt) ((options) &= ~(regopt))
Expand Down Expand Up @@ -742,7 +743,7 @@ void onig_free P_((OnigRegex));
ONIG_EXTERN
void onig_free_body P_((OnigRegex));
ONIG_EXTERN
int onig_scan(regex_t* reg, const UChar* str, const UChar* end, OnigRegion* region, OnigOptionType option, int (*scan_callback)(int, int, OnigRegion*, void*), void* callback_arg);
int onig_scan(regex_t* reg, const OnigUChar* str, const OnigUChar* end, OnigRegion* region, OnigOptionType option, int (*scan_callback)(int, int, OnigRegion*, void*), void* callback_arg);
ONIG_EXTERN
int onig_search P_((OnigRegex, const OnigUChar* str, const OnigUChar* end, const OnigUChar* start, const OnigUChar* range, OnigRegion* region, OnigOptionType option));
ONIG_EXTERN
Expand Down
Loading

0 comments on commit 8961d8a

Please sign in to comment.