<commit_before>/*
 * VmScript.h
 *
 *  Created on: Sep 2, 2014
 *      Author: ranger.shi
 */

#ifndef VMSCRIPT_H_
#define VMSCRIPT_H_

#include "serialize.h"
using namespace std;

/**
 * @brief Load script binary code class
 */
class CVmScript {

public:
	vector<unsigned char> Rom;      		//!< Binary code
	vector<unsigned char> ScriptExplain;	// !<explain the binary code action
	int  scriptType = 0;                    //!<ű 0:8051,1:lua

public:
	/**
	 * @brief
	 * @return
	 */
	bool IsValid()
	{
		///Binary code'size less 64k
		if((Rom.size() > 64*1024) || (Rom.size() <= 0))
			return false;
		if(Rom[0] != 0x02){
			if(!memcmp(&Rom[0],"mylib = require",strlen("mylib = require"))){
				scriptType = 1;//luaű
				return true;//luaűֱӷ
			}else{
				return false;
			}
		}else{
			scriptType = 0;//8051ű
		}

		if(0 == scriptType) {
			return false;//8051ű
		}

		//!<ָ汾SDKϣȥУ ˻ƽ⿪صȡֵ
		if(memcmp(&Rom[0x0004],"\x00\x02\x02",3) >= 0){
           if(!((Rom[0x0014] == 0x00) || (Rom[0x0014] == 0x01))){
        	   return false;
           }
		}
<commit_msg>去掉禁止8051虚拟机代码<commit_after>/*
 * VmScript.h
 *
 *  Created on: Sep 2, 2014
 *      Author: ranger.shi
 */

#ifndef VMSCRIPT_H_
#define VMSCRIPT_H_

#include "serialize.h"
using namespace std;

/**
 * @brief Load script binary code class
 */
class CVmScript {

public:
	vector<unsigned char> Rom;      		//!< Binary code
	vector<unsigned char> ScriptExplain;	// !<explain the binary code action
	int  scriptType = 0;                    //!<ű 0:8051,1:lua

public:
	/**
	 * @brief
	 * @return
	 */
	bool IsValid()
	{
		///Binary code'size less 64k
		if((Rom.size() > 64*1024) || (Rom.size() <= 0))
			return false;
		if(Rom[0] != 0x02){
			if(!memcmp(&Rom[0],"mylib = require",strlen("mylib = require"))){
				scriptType = 1;//luaű
				return true;//luaűֱӷ
			}else{
				return false;
			}
		}else{
			scriptType = 0;//8051ű
		}

		//!<ָ汾SDKϣȥУ ˻ƽ⿪صȡֵ
		if(memcmp(&Rom[0x0004],"\x00\x02\x02",3) >= 0){
           if(!((Rom[0x0014] == 0x00) || (Rom[0x0014] == 0x01))){
        	   return false;
           }
		}

{'fraction_non_alphanumeric': 0.18203766296475132, 'fraction_numerical': 0.06325446644133269, 'mean_word_length': 2.535836177474403, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '58927', 'n_tokens_mistral': 1016, 'n_tokens_neox': 862, 'n_words': 174}