Ejemplo n.º 1
0
        private PropagationInfo getPropagation(ReadSnapshotEntryBase lValue)
        {
            var variable = lValue.GetVariableIdentifier(Input);

            if (!variable.IsDirect)
            {
                throw new NotImplementedException();
            }

            var info = lValue.ReadMemory(Output);

            if (info.Count != 1)
            {
                throw new NotImplementedException();
            }

            var infoValue = info.PossibleValues.First();

            if (infoValue is UndefinedValue)
            {
                //variable hasn't been propagated nowhere already
                return(new PropagationInfo(variable.DirectName.Value));
            }
            else
            {
                //we have propagation info from previous steps
                var result = ((InfoValue <PropagationInfo>)infoValue).Data;
                return(result);
            }
        }
Ejemplo n.º 2
0
        private List <Value> GetValues(ReadSnapshotEntryBase variable)
        {
            MemoryEntry memoryEntry = variable.ReadMemory(valueFactory.Snapshot);

            if (memoryEntry != null && memoryEntry.PossibleValues != null)
            {
                var values = new List <Value>(memoryEntry.PossibleValues.Count());
                values.AddRange(memoryEntry.PossibleValues);
                return(values);
            }

            return(null);
        }
Ejemplo n.º 3
0
        public override MemoryEntry InitializeObject(ReadSnapshotEntryBase newObject, MemoryEntry[] arguments)
        {
            var newObjectValue = newObject.ReadMemory(InSnapshot);

            Flow.Arguments    = arguments;
            Flow.CalledObject = newObjectValue;

            var ctorName = new QualifiedName(new Name("__construct"));
            var ctors    = resolveMethod(newObject, ctorName);

            if (ctors.Count > 0)
            {
                setCallBranching(ctors);
            }

            return(newObjectValue);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Determines whether variable may be undefined or null
        /// </summary>
        /// <param name="variable">variable to check</param>
        /// <returns>true if variable may be undefined or null</returns>
        private bool hasPossibleNullValue(ReadSnapshotEntryBase variable)
        {
            bool nullValue = false;

            OutputSet.Snapshot.SetMode(SnapshotMode.MemoryLevel);
            var values = variable.ReadMemory(OutputSet.Snapshot).PossibleValues;

            foreach (Value value in values)
            {
                if (value is UndefinedValue)
                {
                    nullValue = true;
                    break;
                }
            }
            OutputSet.Snapshot.SetMode(SnapshotMode.InfoLevel);
            return(nullValue);
        }
Ejemplo n.º 5
0
        private bool getTaint(ReadSnapshotEntryBase lValue)
        {
            var info = lValue.ReadMemory(Output);

            return(mergeTaint(info.PossibleValues));
        }
Ejemplo n.º 6
0
        /// <inheritdoc />
        protected override void setAliases(SnapshotBase context, ReadSnapshotEntryBase aliasedEntry)
        {
            var value = aliasedEntry.ReadMemory(context);

            writeMemory(context, value, true);
        }