I was reading Software Security: Building Security In and in the first chapter I faced with 3 terms: bug, defect and flaw. The author gave a definition for each of them but I couldn't completely understand these.Can someone give me some examples for each term?What is a defect and what is a flaw? I think I know what bug is, a bug is a malfunction of a part of system which produces undesirable result, be it crashing on a wrong input or miscalculating a series of computations. Can someone elaborate more and correct me if I am wrong in this? UPDATETo be more precise in the book I mentioned above, they (the words) are presented in a way to make a distinction, that's why I am asking to know more.  In that book there are some examples denoting which sample belongs to what and which category.  For example:  Buffer overflow is said to be a bug and issues in method overriding (subclassing issues) is being related to flaw category.  Again race condition handling issues are considered bugs and Error-handling problems (fails open) are told to be flaws!  I want more elaboration on these regards.
Difference between bug, defect and flaw
terminology;software
The terms that are defined in Software Security: Building Security In are simply the author's definitions of the terms. There are different definitions of the terms, as pointed out in another question here on Programmers. Different sources will use different terms to mean different things - it's why the author in this particular case is choosing to define and give examples of the kinds of problems he means when he uses them.In short, the book uses defect to mean any design or implementation flaw or problem, bug to mean implementation problems (including those that may exist in code paths not executed), and flaw refers to an issue that is manifested in implementation but may stem from design. Bugs and flaws appear to both be specific types of defects.Personally, I find these confusing and very much prefer the definitions provided in dukeofgaming's answer on the other question, which is rooted in the IEEE definitions of the terms.