Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!jarthur!uunet!mcsun!ukc!stl!stc!root44!gwc From: gwc@root.co.uk (Geoff Clare) Newsgroups: comp.lang.c Subject: Re: C obfuscator (Obfuscator code attached) Message-ID: <2219@root44.co.uk> Date: 31 May 90 14:23:12 GMT References: <19858@duke.cs.duke.edu> Organization: UniSoft Ltd., London, England Lines: 42 In <19858@duke.cs.duke.edu> drh@romeo.cs.duke.edu (D. Richard Hipp) writes: >The program below reads a C program from standard input, strips away all >unnecessary white space and writes the results to standard output. The >result is a program which has been obfuscated. BEWARE!! Removing white space can alter C code!! In fact, this is what happened when I compiled Richard's program: line 22: warning: ambiguous assignment: assignment op taken line 22: warning: old-fashioned assignment operator line 22: operands of *= have incompatible types line 22: warning: old-fashioned assignment operator line 22: operands of *= have incompatible types .... line 34: warning: ambiguous assignment: assignment op taken line 34: warning: old-fashioned assignment operator line 34: operands of *= have incompatible types This wouldn't happen with most modern compilers, but serves to demonstrate the problem. After inserting a space in all the '=*'s, the program seemed to run OK, but how do I know it's running correctly? Subtle alterations which may never be noticed are possible, e.g. the expression x = y + ++z; after processing becomes: x=y+++z; which actually parses as: x = y++ + z; This silently changes the behaviour of the code, such that it produces incorrect results and the user is none the wiser. You have been warned! -- Geoff Clare, UniSoft Limited, Saunderson House, Hayne Street, London EC1A 9HH gwc@root.co.uk (Dumb mailers: ...!uunet!root.co.uk!gwc) Tel: +44-71-315-6600