According to ISTQB (and few more sources + wiki ), a defect/bug is the actual cause of error in software, e.g. incorrect statement, logical or semantic error. The actual definion is: a flaw in the system or component that could lead to the failure. But what about specification bugs? I cannot relate to it. Specification bugs are quite common but if the programmer implements software according to spec with a bug, it is not his fault (IMHO). But then the definion could not apply and I am sure it must have been addressed somehow. Could you help me to understand this?
If you're looking for formal terminology, I'd forget the term "bug" all together. Only consider mistake, error, fault, and failure. Based on IEEE610.12-90, the definitions are (as provided in the Software Engineering Body of Knowledge:
Your "bug" is actually what is formally called a fault. However, that fault was injected by a mistake in an earlier process. In your example, the specification contained a mistake.