Is testing for all executables without considering any files in the system is enough for deducing whether the system is infected with malware?

I came to know that the malicious activities will be carried out only by a software(program) whereas the malicious files(data to the softwares installed in the system) can’t perform the malicious activities directly by themselves but they can responsible for bringing those malicious softwares to the system( say like steganography).Hence those softwares also must be installed ( automatically or manually) before performing their activity.

If this is true scanning for malware in softwares before they get installed( triggered manually or automatically) is enough to say that the system is 100% secure(considering that our detector is ideally 100%accurate)?

Deducing Lambda Capture Types

I’ve recently found that capturing a const object by value in a lambda, implies that the variable inside the labmda’s body (i.e. the lambda’s data member) is also const.
For example:

const int x = 0; auto foo = [x]{   // x is const int }; 

This behavior is mentioned in ยง in the draft for C++17:

For each entity captured by copy, an unnamed non-static data member is declared in the closure type. The declaration order of these members is unspecified. The type of such a data member is the referenced type if the entity is a reference to an object, an lvalue reference to the referenced function type if the entity is a reference to a function, or the type of the corresponding captured entity otherwise. A member of an anonymous union shall not be captured by copy.

I would expect that deducing type of captured variables will be the same as deducing auto.
Any good reason for having different type-deduction rules for captured types?

Algorithm for deducing values

I have a group of logical conditions and need to deduce values that would NOT satisfy them. For example:

  1. City != New York && Location = Museum
  2. City = New York && Location = Store
  3. City != New York && Location != Subway
  4. Elevation = 100'

So some values that would NOT satisfy any of those conditions are:

  • City: New York, Location: Museum, Elevation: 110'
  • City: Moscow, Location: Subway, Elevation: 110'

I just need to derive values, any values, that will fail to satisfy all conditions. (Application: Generating manual tests.)

It’s easy to figure out values to violate any one condition, but I’m having trouble coming up with an algorithm to generate values that will violate them all. I have all the logical conditions in a data format (JSON, e.g. { key: 'City', operator: '=', referenceValue = 'New York' }).

Representing a simple function into a state machine / Deducing states from a simple funciton

I wrote a simple function in javascript to reverse a string. For an input string like cat the output would be tac. The code works perfectly fine.

   function flip(text){         let tlen = text.length;         let wlist = [];         let wstr = '';         let outputStr = '';         let punctuationMarks = ['.',',','!','?'];         for(let i=0;i<tlen;i++){             if(text[i] != ' '){             if(punctuationMarks.indexOf(text[i]) != -1){                 wstr = wstr+text[i];             } else {                 wstr = text[i]+wstr;             }             } else {             wlist.push(wstr);             wstr = '';             }         }         wlist.push(wstr);         for(let j=0;j<wlist.length;j++){             outputStr += wlist[j];             if(j<(wlist.length - 1)){             outputStr += ' ';             }         }         console.log(outputStr);     } 

Is there a way, I could represent / transform this code into a state machine? If yes, what would be the states for a simple program as this? I was reading on state machines and thought for a while, if it was possible to represent my simple function to reverse a string into a state machine.