mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-14 21:09:05 +08:00
commit
224f3ab937
@ -27,6 +27,13 @@ Supported character encodings:
|
||||
* doc/SYNTAX.md: contributed by seanofw
|
||||
|
||||
|
||||
Master branch
|
||||
-------------
|
||||
|
||||
* Fixed CVE-2019-13224
|
||||
* Fixed CVE-2019-13225
|
||||
|
||||
|
||||
New feature of version 6.9.2 (Reiwa)
|
||||
-----------------------------------
|
||||
|
||||
|
||||
@ -18,8 +18,10 @@
|
||||
#define SIZEOF_OFF_T 4
|
||||
#if defined(_WIN64)
|
||||
#define SIZEOF_VOIDP 8
|
||||
#define SIZEOF_SIZE_T 8
|
||||
#else
|
||||
#define SIZEOF_VOIDP 4
|
||||
#define SIZEOF_SIZE_T 4
|
||||
#endif
|
||||
#define SIZEOF_FLOAT 4
|
||||
#define SIZEOF_DOUBLE 8
|
||||
|
||||
@ -1307,8 +1307,9 @@ compile_length_bag_node(BagNode* node, regex_t* reg)
|
||||
len += tlen;
|
||||
}
|
||||
|
||||
len += SIZE_OP_JUMP + SIZE_OP_ATOMIC_END;
|
||||
|
||||
if (IS_NOT_NULL(Else)) {
|
||||
len += SIZE_OP_JUMP;
|
||||
tlen = compile_length_tree(Else, reg);
|
||||
if (tlen < 0) return tlen;
|
||||
len += tlen;
|
||||
@ -1455,7 +1456,7 @@ compile_bag_node(BagNode* node, regex_t* reg, ScanEnv* env)
|
||||
|
||||
case BAG_IF_ELSE:
|
||||
{
|
||||
int cond_len, then_len, jump_len;
|
||||
int cond_len, then_len, else_len, jump_len;
|
||||
Node* cond = NODE_BAG_BODY(node);
|
||||
Node* Then = node->te.Then;
|
||||
Node* Else = node->te.Else;
|
||||
@ -1472,8 +1473,7 @@ compile_bag_node(BagNode* node, regex_t* reg, ScanEnv* env)
|
||||
else
|
||||
then_len = 0;
|
||||
|
||||
jump_len = cond_len + then_len + SIZE_OP_ATOMIC_END;
|
||||
if (IS_NOT_NULL(Else)) jump_len += SIZE_OP_JUMP;
|
||||
jump_len = cond_len + then_len + SIZE_OP_ATOMIC_END + SIZE_OP_JUMP;
|
||||
|
||||
r = add_op(reg, OP_PUSH);
|
||||
if (r != 0) return r;
|
||||
@ -1490,11 +1490,20 @@ compile_bag_node(BagNode* node, regex_t* reg, ScanEnv* env)
|
||||
}
|
||||
|
||||
if (IS_NOT_NULL(Else)) {
|
||||
int else_len = compile_length_tree(Else, reg);
|
||||
r = add_op(reg, OP_JUMP);
|
||||
if (r != 0) return r;
|
||||
COP(reg)->jump.addr = else_len + SIZE_INC_OP;
|
||||
else_len = compile_length_tree(Else, reg);
|
||||
if (else_len < 0) return else_len;
|
||||
}
|
||||
else
|
||||
else_len = 0;
|
||||
|
||||
r = add_op(reg, OP_JUMP);
|
||||
if (r != 0) return r;
|
||||
COP(reg)->jump.addr = SIZE_OP_ATOMIC_END + else_len + SIZE_INC_OP;
|
||||
|
||||
r = add_op(reg, OP_ATOMIC_END);
|
||||
if (r != 0) return r;
|
||||
|
||||
if (IS_NOT_NULL(Else)) {
|
||||
r = compile_tree(Else, reg, env);
|
||||
}
|
||||
}
|
||||
|
||||
@ -170,9 +170,7 @@ onig_new_deluxe(regex_t** reg, const UChar* pattern, const UChar* pattern_end,
|
||||
if (IS_NOT_NULL(einfo)) einfo->par = (UChar* )NULL;
|
||||
|
||||
if (ci->pattern_enc != ci->target_enc) {
|
||||
r = conv_encoding(ci->pattern_enc, ci->target_enc, pattern, pattern_end,
|
||||
&cpat, &cpat_end);
|
||||
if (r != 0) return r;
|
||||
return ONIGERR_NOT_SUPPORTED_ENCODING_COMBINATION;
|
||||
}
|
||||
else {
|
||||
cpat = (UChar* )pattern;
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
#ifdef ONIG_ESCAPE_UCHAR_COLLISION
|
||||
#undef ONIG_ESCAPE_UCHAR_COLLISION
|
||||
#endif
|
||||
#include "oniguruma.h" // Oniguruma - Regular Expression Engine (v6.9.0)
|
||||
#include "oniguruma.h" // Oniguruma - Regular Expression Engine (v6.9.2)
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
#define UCharPtr(pchar) reinterpret_cast<OnigUChar*>(pchar)
|
||||
@ -71,25 +71,29 @@ static void SetSimpleOptions(OnigOptionType& onigOptions,
|
||||
// fixed options
|
||||
onigOptions = ONIG_OPTION_DEFAULT;
|
||||
|
||||
// OFF: not wanted options in Notepad3
|
||||
// Notepad3 forced options
|
||||
ONIG_OPTION_OFF(onigOptions, ONIG_OPTION_EXTEND);
|
||||
ONIG_OPTION_OFF(onigOptions, ONIG_OPTION_SINGLELINE);
|
||||
ONIG_OPTION_ON(onigOptions, ONIG_OPTION_NEGATE_SINGLELINE);
|
||||
//ONIG_OPTION_OFF(onigOptions, ONIG_OPTION_ASCII_RANGE);
|
||||
//ONIG_OPTION_OFF(onigOptions, ONIG_OPTION_CAPTURE_GROUP);
|
||||
|
||||
// ONIG_OPTION_DOTALL == ONIG_OPTION_MULTILINE
|
||||
// dynamic options
|
||||
if (searchFlags & SCFIND_DOT_MATCH_ALL) {
|
||||
ONIG_OPTION_ON(onigOptions, ONIG_SYN_OP_DOT_ANYCHAR);
|
||||
ONIG_OPTION_ON(onigOptions, ONIG_OPTION_MULTILINE);
|
||||
}
|
||||
else {
|
||||
ONIG_OPTION_OFF(onigOptions, ONIG_SYN_OP_DOT_ANYCHAR);
|
||||
ONIG_OPTION_OFF(onigOptions, ONIG_OPTION_MULTILINE);
|
||||
}
|
||||
|
||||
ONIG_OPTION_ON(onigOptions, ONIG_OPTION_SINGLELINE);
|
||||
//ONIG_OPTION_ON(onigOptions, ONIG_OPTION_NEGATE_SINGLELINE);
|
||||
|
||||
ONIG_OPTION_OFF(onigOptions, ONIG_OPTION_CAPTURE_GROUP);
|
||||
|
||||
// dynamic options
|
||||
ONIG_OPTION_ON(onigOptions, caseSensitive ? ONIG_OPTION_NONE : ONIG_OPTION_IGNORECASE);
|
||||
if (!caseSensitive) {
|
||||
ONIG_OPTION_ON(onigOptions, ONIG_OPTION_IGNORECASE);
|
||||
}
|
||||
else {
|
||||
ONIG_OPTION_OFF(onigOptions, ONIG_OPTION_IGNORECASE);
|
||||
}
|
||||
}
|
||||
// ============================================================================
|
||||
|
||||
@ -102,7 +106,6 @@ class OnigurumaRegExEngine : public RegexSearchBase
|
||||
public:
|
||||
|
||||
explicit OnigurumaRegExEngine(CharClassify* charClassTable)
|
||||
//: m_OnigSyntax(*ONIG_SYNTAX_PERL)
|
||||
: m_OnigSyntax(*ONIG_SYNTAX_DEFAULT)
|
||||
, m_CmplOptions(ONIG_OPTION_DEFAULT)
|
||||
, m_RegExpr(nullptr)
|
||||
@ -111,7 +114,7 @@ public:
|
||||
, m_MatchPos(ONIG_MISMATCH)
|
||||
, m_MatchLen(0)
|
||||
{
|
||||
m_OnigSyntax.op |= ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END;
|
||||
m_OnigSyntax.op |= ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END; // xcluded from ONIG_SYNTAX_DEFAULT ?
|
||||
onig_initialize(g_UsedEncodingsTypes, _ARRAYSIZE(g_UsedEncodingsTypes));
|
||||
onig_region_init(&m_Region);
|
||||
}
|
||||
@ -643,7 +646,7 @@ class SimpleRegExEngine
|
||||
public:
|
||||
|
||||
SimpleRegExEngine()
|
||||
: m_OnigSyntax(*ONIG_SYNTAX_PERL)
|
||||
: m_OnigSyntax(*ONIG_SYNTAX_DEFAULT)
|
||||
, m_Options(ONIG_OPTION_DEFAULT)
|
||||
, m_RegExpr(nullptr)
|
||||
, m_Region({ 0,0,nullptr,nullptr,nullptr })
|
||||
@ -651,7 +654,7 @@ public:
|
||||
, m_MatchPos(ONIG_MISMATCH)
|
||||
, m_MatchLen(0)
|
||||
{
|
||||
m_OnigSyntax.op |= ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END;
|
||||
m_OnigSyntax.op |= ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END; // xcluded from ONIG_SYNTAX_DEFAULT ?
|
||||
onig_initialize(g_UsedEncodingsTypes, _ARRAYSIZE(g_UsedEncodingsTypes));
|
||||
onig_region_init(&m_Region);
|
||||
}
|
||||
|
||||
@ -3519,11 +3519,11 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
dwFileAttributes |= FILE_ATTRIBUTE_READONLY;
|
||||
}
|
||||
if (!SetFileAttributes(Globals.CurrentFile, dwFileAttributes)) {
|
||||
InfoBoxLng(MB_ICONWARNING, NULL, IDS_MUI_READONLY_MODIFY, Globals.CurrentFile);
|
||||
InfoBoxLng(MB_ICONWARNING, NULL, IDS_MUI_READONLY_MODIFY, PathFindFileName(Globals.CurrentFile));
|
||||
}
|
||||
}
|
||||
else {
|
||||
InfoBoxLng(MB_ICONWARNING, NULL, IDS_MUI_READONLY_MODIFY, Globals.CurrentFile);
|
||||
InfoBoxLng(MB_ICONWARNING, NULL, IDS_MUI_READONLY_MODIFY, PathFindFileName(Globals.CurrentFile));
|
||||
}
|
||||
dwFileAttributes = GetFileAttributes(Globals.CurrentFile);
|
||||
if (dwFileAttributes != INVALID_FILE_ATTRIBUTES)
|
||||
@ -9387,7 +9387,7 @@ bool FileLoad(bool bDontSave, bool bNew, bool bReload,
|
||||
{
|
||||
bool bCreateFile = s_flagQuietCreate;
|
||||
if (!bCreateFile) {
|
||||
INT_PTR const answer = InfoBoxLng(MB_YESNO | MB_ICONQUESTION, NULL, IDS_MUI_ASK_CREATE, szFileName);
|
||||
INT_PTR const answer = InfoBoxLng(MB_YESNO | MB_ICONQUESTION, NULL, IDS_MUI_ASK_CREATE, PathFindFileName(szFileName));
|
||||
if ((IDOK == answer) || (IDYES == answer)) {
|
||||
bCreateFile = true;
|
||||
}
|
||||
@ -9574,7 +9574,7 @@ bool FileLoad(bool bDontSave, bool bNew, bool bReload,
|
||||
|
||||
}
|
||||
else if (!(fioStatus.bFileTooBig || fioStatus.bUnknownExt)) {
|
||||
InfoBoxLng(MB_ICONWARNING, NULL, IDS_MUI_ERR_LOADFILE, szFileName);
|
||||
InfoBoxLng(MB_ICONWARNING, NULL, IDS_MUI_ERR_LOADFILE, PathFindFileName(szFileName));
|
||||
}
|
||||
|
||||
UpdateAllBars(true);
|
||||
@ -9784,7 +9784,7 @@ bool FileSave(bool bSaveAlways, bool bAsk, bool bSaveAs, bool bSaveCopy)
|
||||
s_bFileReadOnly = (dwFileAttributes & FILE_ATTRIBUTE_READONLY);
|
||||
if (s_bFileReadOnly) {
|
||||
UpdateToolbar();
|
||||
INT_PTR const answer = InfoBoxLng(MB_YESNO | MB_ICONWARNING, NULL, IDS_MUI_READONLY_SAVE, Globals.CurrentFile);
|
||||
INT_PTR const answer = InfoBoxLng(MB_YESNO | MB_ICONWARNING, NULL, IDS_MUI_READONLY_SAVE, PathFindFileName(Globals.CurrentFile));
|
||||
if ((IDOK == answer) || (IDYES == answer)) {
|
||||
bSaveAs = true;
|
||||
}
|
||||
@ -9866,7 +9866,7 @@ bool FileSave(bool bSaveAlways, bool bAsk, bool bSaveAs, bool bSaveCopy)
|
||||
{
|
||||
if (!s_bIsElevated && (Globals.dwLastError == ERROR_ACCESS_DENIED))
|
||||
{
|
||||
INT_PTR const answer = InfoBoxLng(MB_YESNO | MB_ICONWARNING, NULL, IDS_MUI_ERR_ACCESSDENIED, Globals.CurrentFile);
|
||||
INT_PTR const answer = InfoBoxLng(MB_YESNO | MB_ICONWARNING, NULL, IDS_MUI_ERR_ACCESSDENIED, PathFindFileName(Globals.CurrentFile));
|
||||
if ((IDOK == answer) || (IDYES == answer)) {
|
||||
if (DoElevatedRelaunch(&fioStatus))
|
||||
{
|
||||
@ -9875,13 +9875,13 @@ bool FileSave(bool bSaveAlways, bool bAsk, bool bSaveAs, bool bSaveCopy)
|
||||
else {
|
||||
s_flagAppIsClosing = false;
|
||||
UpdateToolbar();
|
||||
InfoBoxLng(MB_ICONWARNING, NULL, IDS_MUI_ERR_SAVEFILE, Globals.CurrentFile);
|
||||
InfoBoxLng(MB_ICONWARNING, NULL, IDS_MUI_ERR_SAVEFILE, PathFindFileName(Globals.CurrentFile));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
UpdateToolbar();
|
||||
InfoBoxLng(MB_ICONWARNING, NULL, IDS_MUI_ERR_SAVEFILE, Globals.CurrentFile);
|
||||
InfoBoxLng(MB_ICONWARNING, NULL, IDS_MUI_ERR_SAVEFILE, PathFindFileName(Globals.CurrentFile));
|
||||
}
|
||||
}
|
||||
return fSuccess;
|
||||
|
||||
@ -674,7 +674,7 @@ bool Style_Export(HWND hwnd)
|
||||
Globals.dwLastError = Style_ExportToFile(szFile, true);
|
||||
|
||||
if (Globals.dwLastError != ERROR_SUCCESS) {
|
||||
InfoBoxLng(MB_ICONERROR, NULL, IDS_MUI_EXPORT_FAIL, szFile);
|
||||
InfoBoxLng(MB_ICONERROR, NULL, IDS_MUI_EXPORT_FAIL, PathFindFileName(szFile));
|
||||
}
|
||||
}
|
||||
return (Globals.dwLastError == ERROR_SUCCESS);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user