You should be careful when using theoretical result to argue something cannot be done in practice. There are several dangers that one can fall in:
the theoretical result has assumptions that doesn't apply,
the problem in practice is not modeled well by the theoretical model,
in practice a solution doesn't need to be perfect to be useful.
You haven't given a formal definition of what is a virus so expanding on your claim about the trivial exercise can be helpful in understanding what you really mean.
A large part of what an antivirus software do is detecting known viruses (and their variants), and this is done by comparing strings (in files, memory, etc) with a finite list of strings (virus signatures). That is why we need to update the database of the antivirus software regularly.
There are additional capabilities on detecting potential viruses based on their "behavior", but these methods are neither complete nor sound (and they don't need to be sound/complete to be useful). Designing a antivirus software seems to fall more in computer engineering than computer science so far (though computer science and computer engineering are closely related).
Generally these studies would fall in more applied part of computer-security (and more generally system areas: computer networks, operating systems, etc.) of computer science, but using ideas from other parts of computer science (machine learning, etc.) is typical.
You may want to check The Art of Computer Virus Research and Defense.