From a753d8c3bf5e3fe6dee9df8a9a4047cda6435806 Mon Sep 17 00:00:00 2001 From: msojocs Date: Sat, 26 Aug 2023 15:31:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=80=BB=E8=BE=91=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/wxss/css_tree_lib/lexical_checker.cpp | 27 ++++++++++++++++++++--- src/wxss/css_tree_lib/parser.cpp | 1 + src/wxss/x_compiler.cpp | 3 +++ test/wcsc.disassembly.cpp | 10 ++++++--- 4 files changed, 35 insertions(+), 6 deletions(-) diff --git a/src/wxss/css_tree_lib/lexical_checker.cpp b/src/wxss/css_tree_lib/lexical_checker.cpp index 7b62a05..7764eaf 100644 --- a/src/wxss/css_tree_lib/lexical_checker.cpp +++ b/src/wxss/css_tree_lib/lexical_checker.cpp @@ -9,10 +9,12 @@ namespace WXSS { namespace CSSTreeLib { - + int off_519A58_i = 0; // WXSS::CSSTreeLib::MarkHostRule::MarkGood int off_519A58(std::shared_ptr& a1, std::shared_ptr &a2) { + off_519A58_i++; + int inner_off_519A58_i = off_519A58_i; for (auto lt = a2->offset_120.begin(); lt != a2->offset_120.end(); lt++) { if ((*lt)->offset_0 == "SELECTORS") @@ -244,7 +246,7 @@ namespace WXSS int off_519AD0(std::shared_ptr& a1, std::shared_ptr &a2) { MarkSelectorRule_i++; - int inner_MarkSelectorRule_i = MarkSelectorRule_i; // TODO: 校对至80 + int inner_MarkSelectorRule_i = MarkSelectorRule_i; // 771有问题 // MarkSelectorRule - 0 for (int i = 0; i < a2->offset_120.size(); i++) { @@ -441,7 +443,7 @@ namespace WXSS break; } // MarkSelectorRule - 20 - auto v3 = cur->offset_120[0]; + auto v3 = cur->offset_120[1]; std::string lit = v3->offset_24.GetLiteral(); if (v3->offset_0[0] != '$' || strcmp(v3->offset_0.data() + 1, "NAME") @@ -487,9 +489,13 @@ namespace WXSS } return 0; } + + int off_519B00_i = 0; // WXSS::CSSTreeLib::RewriteSelectorRule::MarkGood int off_519B00(std::shared_ptr& a1, std::shared_ptr &a2) { + off_519B00_i++; + int inner_off_519B00_i = off_519B00_i; std::string v14; std::string lit = a2->offset_24.GetLiteral(); if (lit.length()) @@ -554,8 +560,15 @@ namespace WXSS } // WXSS::CSSTreeLib::AndRules::MarkGood + int off_519B40_i = 0; int off_519B40(std::shared_ptr& a1, std::shared_ptr &a2) { + off_519B40_i++; + int inner_off_519B40_i = off_519B40_i; + if (inner_off_519B40_i >= 3611) + { + int a = 0; + } for (int i=0; i < a1->offset_4_vecPtr.size(); i++) { auto cur = a1->offset_4_vecPtr[i]; @@ -585,6 +598,10 @@ namespace WXSS { off_519B84_i++; int inner_off_519B84_i = off_519B84_i; + if (inner_off_519B84_i >= 9100) + { + int a = 0; + } int v8 = 1; for (int j = 0; j < a2->offset_120.size(); j++) { @@ -615,6 +632,10 @@ namespace WXSS { off_519BB4_i++; int inner_off_519BB4_i = off_519BB4_i; + if (inner_off_519BB4_i >= 4218) + { + int a = 0; + } int ret = 0; for (int i = 0; i < a1->offset_4_vecPtr.size(); i++) { diff --git a/src/wxss/css_tree_lib/parser.cpp b/src/wxss/css_tree_lib/parser.cpp index 13561cc..4eb9e2a 100644 --- a/src/wxss/css_tree_lib/parser.cpp +++ b/src/wxss/css_tree_lib/parser.cpp @@ -70,6 +70,7 @@ namespace WXSS v9[1].assign(a5); std::shared_ptr v14(new WXSS::Token()); v14->offset_4.reset(new std::string()); + v14->offset_12 = -1; // Parse - 20 int v75 = 0; diff --git a/src/wxss/x_compiler.cpp b/src/wxss/x_compiler.cpp index 6ed1476..39a88d6 100644 --- a/src/wxss/x_compiler.cpp +++ b/src/wxss/x_compiler.cpp @@ -396,10 +396,12 @@ namespace WXSS { GetPageCss_i++; int inner_GetPageCss_i = GetPageCss_i; + // GetPageCss - 0 if (this->offset_0) { return 6; } + // GetPageCss - 5 if (this->offset_32.find(a2) == this->offset_32.end()) { std::stringstream v38; @@ -411,6 +413,7 @@ namespace WXSS } else { + // GetPageCss - 10 std::string v30; auto v23 = this->offset_32; diff --git a/test/wcsc.disassembly.cpp b/test/wcsc.disassembly.cpp index 2977389..fdc1409 100644 --- a/test/wcsc.disassembly.cpp +++ b/test/wcsc.disassembly.cpp @@ -8275,12 +8275,15 @@ int __thiscall WXSS::XCompiler::GetPageCss(char *this, int *a2, _DWORD *a3, int char v39[4]; // [esp+B8h] [ebp-D0h] BYREF char v40[204]; // [esp+BCh] [ebp-CCh] BYREF + // GetPageCss - 0 v22 = *(_DWORD *)this; if ( *(_DWORD *)this ) return 6; + // GetPageCss - 5 v23 = (std::ostream::sentry *)(this + 32); - if ( this + 36 == (char *)std::_Rb_tree>,std::_Select1st>>,std::less,std::allocator>>>::find( - (_DWORD *)this + 8, + if ( this + 36 == (char *)std::_Rb_tree>,std::_Select1st>>,std::less,std::allocator>>> + ::find( + (_DWORD *)this + 8, // this->offset_32 (int)a2) ) { std::basic_stringstream,std::allocator>::basic_stringstream((int)v38); @@ -8300,6 +8303,7 @@ int __thiscall WXSS::XCompiler::GetPageCss(char *this, int *a2, _DWORD *a3, int } else { + // GetPageCss - 10 v30 = (int)&v32; // std::string v31 = 0; v32 = 0; @@ -11345,7 +11349,7 @@ int __thiscall WXSS::CSSTreeLib::Parser::Parse(int this, char **a2, int *a3, uns v109 = v15; v115 = v18; std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count(&v115); - *(_DWORD *)(v108 + 12) = -1; + *(_DWORD *)(v108 + 12) = -1; // v14->offset_12 v79 = (char *)operator new(0x18u); // 0x18 -> 24 std::string::basic_string(v79, (int)a3);