Пример #1
0
 public FunctionConfig(string fname, Types retType, Taint retTaint, IList <Param> param)
 {
     name        = fname;
     returnType  = retType;
     returnTaint = retTaint;
     parameters  = param;
     CheckFunction();
 }
Пример #2
0
 public FunctionConfig(string fname, Types retType, Taint retTaint, IList<Param> param)
 {
     name = fname;
     returnType = retType;
     returnTaint = retTaint;
     parameters = param;
     CheckFunction();
 }
Пример #3
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
                string     fname           = tbFname.Text;
                Types      returnType      = FunctionConfig.TypeFromStr((string)comboType.SelectedItem);
                TaintTypes returnTaintType = FunctionConfig.TaintFromStr((string)comboTaint.SelectedItem);
                Taint      returnTaint     = new Taint(returnTaintType);
                if (returnTaintType == TaintTypes.G)
                {
                    string[] returnDepNames = tbReturnDeps.Text.Split(new char[] { ' ' });
                    foreach (string retDep in returnDepNames)
                    {
                        returnTaint.getDependencies().Add(retDep);
                    }
                }
                IList <FunctionConfig.Param> parameters = new List <FunctionConfig.Param>();
                foreach (DataGridViewRow row in dgParams.Rows)
                {
                    if (row.IsNewRow)
                    {
                        continue;
                    }
                    string     pName      = (string)row.Cells["Name"].Value;
                    Types      pType      = FunctionConfig.TypeFromStr((string)row.Cells["Type"].Value);
                    TaintTypes pTaintType = FunctionConfig.TaintFromStr((string)row.Cells["Taint"].Value);
                    Taint      pTaint     = new Taint(pTaintType);
                    if (pTaintType == TaintTypes.G)
                    {
                        string[] paramDepNames = ((string)row.Cells["Deps"].Value).Split(new char[] { ' ' });
                        foreach (string paramDep in paramDepNames)
                        {
                            pTaint.getDependencies().Add(paramDep);
                        }
                    }
                    FunctionConfig.Param param = new FunctionConfig.Param();
                    param.name       = pName;
                    param.paramType  = pType;
                    param.paramTaint = pTaint;
                    parameters.Add(param);
                }

                function = new FunctionConfig(fname, returnType, returnTaint, parameters);
            }
            catch (InvalidOperationException)
            {
                MessageBox.Show("Function cannot be added! Invalid dependencies");
                this.DialogResult = DialogResult.Cancel;
            }
        }
Пример #4
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
                string fname = tbFname.Text;
                Types returnType = FunctionConfig.TypeFromStr((string)comboType.SelectedItem);
                TaintTypes returnTaintType = FunctionConfig.TaintFromStr((string)comboTaint.SelectedItem);
                Taint returnTaint = new Taint(returnTaintType);
                if (returnTaintType == TaintTypes.G)
                {
                    string[] returnDepNames = tbReturnDeps.Text.Split(new char[] { ' ' });
                    foreach (string retDep in returnDepNames)
                    {
                        returnTaint.getDependencies().Add(retDep);
                    }
                }
                IList<FunctionConfig.Param> parameters = new List<FunctionConfig.Param>();
                foreach (DataGridViewRow row in dgParams.Rows)
                {
                    if (row.IsNewRow)
                        continue;
                    string pName = (string)row.Cells["Name"].Value;
                    Types pType = FunctionConfig.TypeFromStr((string)row.Cells["Type"].Value);
                    TaintTypes pTaintType = FunctionConfig.TaintFromStr((string)row.Cells["Taint"].Value);
                    Taint pTaint = new Taint(pTaintType);
                    if (pTaintType == TaintTypes.G)
                    {
                        string[] paramDepNames = ((string)row.Cells["Deps"].Value).Split(new char[] { ' ' });
                        foreach (string paramDep in paramDepNames)
                        {
                            pTaint.getDependencies().Add(paramDep);
                        }
                    }
                    FunctionConfig.Param param = new FunctionConfig.Param();
                    param.name = pName;
                    param.paramType = pType;
                    param.paramTaint = pTaint;
                    parameters.Add(param);
                }

                function = new FunctionConfig(fname, returnType, returnTaint, parameters);
            }
            catch (InvalidOperationException)
            {
                MessageBox.Show("Function cannot be added! Invalid dependencies");
                this.DialogResult = DialogResult.Cancel;
            }
        }
Пример #5
0
        private static FunctionConfig builfFunctionConfig(StreamReader reader)
        {
            ReadStr(reader);
            ReadStr(reader);
            string fname        = ReadStr(reader);
            Types  retType      = TypeFromStr(ReadStr(reader));
            Taint  retTaint     = new Taint(TaintFromStr(ReadStr(reader)));
            int    retDepsCount = ReadInt(reader);

            for (int i = 0; i < retDepsCount; ++i)
            {
                string retDepName = ReadStr(reader);
                retTaint.getDependencies().Add(retDepName);
            }
            int           paramCount = ReadInt(reader);
            IList <Param> parameters = new List <Param>();

            for (int i = 0; i < paramCount; ++i)
            {
                ReadStr(reader);
                string paramName      = ReadStr(reader);
                Types  paramType      = TypeFromStr(ReadStr(reader));
                Taint  paramTaint     = new Taint(TaintFromStr(ReadStr(reader)));
                int    paramDepsCount = ReadInt(reader);
                for (int j = 0; j < paramDepsCount; ++j)
                {
                    string paramDepName = ReadStr(reader);
                    paramTaint.getDependencies().Add(paramDepName);
                }
                Param newParam = new Param();
                newParam.name       = paramName;
                newParam.paramTaint = paramTaint;
                newParam.paramType  = paramType;
                parameters.Add(newParam);
            }
            return(new FunctionConfig(fname, retType, retTaint, parameters));
        }
Пример #6
0
 private static FunctionConfig builfFunctionConfig(StreamReader reader)
 {
     ReadStr(reader);
     ReadStr(reader);
     string fname = ReadStr(reader);
     Types retType = TypeFromStr(ReadStr(reader));
     Taint retTaint = new Taint(TaintFromStr(ReadStr(reader)));
     int retDepsCount = ReadInt(reader);
     for (int i = 0; i < retDepsCount; ++i)
     {
         string retDepName = ReadStr(reader);
         retTaint.getDependencies().Add(retDepName);
     }
     int paramCount = ReadInt(reader);
     IList<Param> parameters = new List<Param>();
     for (int i = 0; i < paramCount; ++i)
     {
         ReadStr(reader);
         string paramName = ReadStr(reader);
         Types paramType = TypeFromStr(ReadStr(reader));
         Taint paramTaint = new Taint(TaintFromStr(ReadStr(reader)));
         int paramDepsCount = ReadInt(reader);
         for (int j = 0; j < paramDepsCount; ++j)
         {
             string paramDepName = ReadStr(reader);
             paramTaint.getDependencies().Add(paramDepName);
         }
         Param newParam = new Param();
         newParam.name = paramName;
         newParam.paramTaint = paramTaint;
         newParam.paramType = paramType;
         parameters.Add(newParam);
     }
     return new FunctionConfig(fname, retType, retTaint, parameters);
 }