43

While investigating Wikipedia article on Qantas Flight 72 I've found "Potential trigger types" section that says (emphasis mine):

A number of potential trigger types were investigated, including software bugs, software corruption, hardware faults, electromagnetic interference and the secondary high-energy particles generated by cosmic rays.

I wonder if there is any distinctive and ultimate difference between "bug" and "corruption" (if yes, then what is the difference) or is this just an article's wording and nothing else?

Christophe
  • 74,672
  • 10
  • 115
  • 187
trejder
  • 2,386
  • 3
  • 19
  • 39
  • 3
    well, a wrong breaking condition within a recursive function (bug) is kinda different from missing a dependency in the proper version or a buggy installation process or failures on the hardware altering the binaries that comprise the system. And way more different than cosmic rays frying the whole system (software corruption). – Laiv Sep 29 '20 at 08:09
  • 41
    There is a [reference](https://www.atsb.gov.au/media/3532398/ao2008070.pdf) given at the Wikipedia article you cited, exactly for that paragraph. If you search the linked PDF for "corruption", you find a whole section on page 156 titled "Software corruption". They talk about a data corruption in the ROM where the software is stored. (I vote -1, since askers here on this site are expected to show some research effort on their own before they ask, don't take it personal). – Doc Brown Sep 29 '20 at 09:16
  • 7
    Software corruption is not a standard term. The ISTQB uses the terms bug/fault/defect for the general observation that a software doesn't meet its requirements. The cause of that defect could e.g. be hardware faults, or human errors during software development. But since the referenced document defines “software corruption”, its usage seems unambiguous. – amon Sep 29 '20 at 09:50
  • @DocBrown While I agree with you (nothing personal taken) I also searched this site and found not too much about this topic. So I decided to ask, to make this knowledge available to others. If I'd some research, I'd refrain myself from asking and this knowledge benefit only me. – trejder Sep 29 '20 at 14:54
  • 5
    @trejder: after reading some of the answers, I removed my downvote. I think the question is good enough as it is. – Doc Brown Sep 29 '20 at 15:47
  • 3
    N.B. the higher up in the atmosphere you go the greater chance of random memory corruption, due to increased radiation. We usually ignore it for normal computers, but on a big jet liner it becomes a real concern. – OrangeDog Sep 30 '20 at 09:20
  • 1
    What is funny for me about this question is the way the term "bug" was introduced into software development. It was an actual insect in the computer that prevent one of the pins in the system to drop through the punch card, causing a malfunctioning program. This to me is exactly what software corruption would be as the hardware caused the software to malfunction. – Jonathan van de Veen Oct 07 '20 at 09:14
  • @JonathanvandeVeen I've heard a quite different story. That the term "bug" was coined by an early IT age woman to denote an actual bug (a moth?) that flown into hardware section of one of the early computers (Eniac?) and caused one of the lamps to burn which resulted in an incorrect calculation results. Never heard a story about punch card and a pin though. – trejder Oct 08 '20 at 10:26
  • 1
    @trejer. That is interesting. And proves the same point, though. Bugs originally were software corruption and not developer error. – Jonathan van de Veen Oct 08 '20 at 15:09
  • 1
    It's worth noting that a bug can lead to corruption. Consider an operating environment with multiple calling conventions (like, say, Windows). In some cases, the caller cleans up the stack, in others, the callee cleans up. Now consider the case where a program calls into a rarely used external module and uses the incorrect calling convention. The stack will be unbalanced across the call, corrupting the stack and resulting in random memory being executed (and, yes, it happens) – Flydog57 Oct 13 '20 at 04:30

7 Answers7

94

Software corruption is the contrary of software integrity. It's the same thing as data corruption, except that the data is the software code.

It can affect:

  • the software binary stored in memory: binary codes of software instructions are altered for example because of physical interference (“please switch off electronic devices during take-off and landing”), hardware defects (memory chip), malicious activities (e.g. row hammer vulnerability), or software bugs (i.e. as a consequence of a buffer overflow).
  • the software binary before it is loaded in memory, i.e. the executable file stored in a file system (e.g. SSD memory, hard disk, ...) or transiting via the network (e.g. loaded from a remote file server).
  • the software source code before the executable is produced: the source code is data like any other, that can be corrupted in the same situation as any data. A typical example is when a software company’s source code repository gets hacked (accidental cases generally prevent compilation and have a very limited impact)

Note that “software corruption” may be used ambiguously to mean corruption caused by the software instead of corruption of the software itself.

IMSoP
  • 5,722
  • 1
  • 21
  • 26
Christophe
  • 74,672
  • 10
  • 115
  • 187
  • 2
    Might be worth to mention that "accidental cases" don't prevent compilation in interpreted languages, and will probably just cause them to crash when run. – Erik Sep 30 '20 at 10:00
  • 5
    @Erik You are completely right! Sorry for my compiled language bias reinforced by the aeronautic context of the question ;-) – Christophe Sep 30 '20 at 11:10
  • 1
    Since you mention source corruption and binary storage/transmission, you may as well want to include the generation of a corrupted binary by the compiler / tool chain. – Didier L Sep 30 '20 at 12:32
  • I don't think the ambiguity mentioned in the last paragraph exists when you're explicitly distinguishing software corruption from software bugs, as in the original quote. It only exists when there's less context. – Barmar Sep 30 '20 at 13:57
  • 1
    The best example of "software corruption" in can think of is a blog post I read a few years ago where I guy traced down this horrendously confusing error that turned out to be "cosmic ray bit-flip in the non-ECC memory backing the Linux disk cache entry for one of his binaries". I'd link it, but Google isn't being helpful. – ssokolow Oct 07 '20 at 19:40
  • 1
    @Erik: in the general case you are right, but in this specific case I hope they don't use PHP, JavaScript or even Python in the A330's flight control software... – rob74 Oct 14 '20 at 12:46
  • 1
    @rob74 me neither, but the question is more generic than the example that triggered it :) – Erik Oct 14 '20 at 13:10
28

You can fix corruption by restoring from a good back up. Corruption means some of the bits somehow got changed from what they were meant to be.

You can fix a bug* by doing more development and redeploying. Here the bits are what they were meant to be. They just don’t do what we need them to do.

*Of course this assumes that bug means a defect in source code, not a moth stuck between relay contacts.

candied_orange
  • 102,279
  • 24
  • 197
  • 315
20

A bug is when a software does exactly what the programmer told it to do, instead of what the programmer wanted it to do.

A corruption is when a software does something else than what the programmer told it to do, possibly due to hardware failure, or other problems not directly related to software development.

vsz
  • 1,486
  • 9
  • 17
  • I like this answer. Also, many times bugs are features (for hackers) and features are bugs (to an advanced user). – Tomachi Oct 07 '20 at 04:30
15

Presumably what they mean by "software corruption" is unintended changes to the contents of an executable file due to things like a failure of the storage media.

A "bug" would mean that the binaries are the same as the originals which were provided by the software vendor or developer, but that there was some programming error which means they don't behave exactly as intended.

Alex D
  • 1,308
  • 9
  • 14
7

I write a program, it gets compiled, sent to you, you install it on your computer. But a few bits have changed on the way. That is software corruption.

gnasher729
  • 42,090
  • 4
  • 59
  • 119
  • 3
    Excellent! Maybe worth to add that corruption can be the result of a malicious action (e.g. [row hammer](https://en.wikipedia.org/wiki/Row_hammer) or accidental (hardware defect flipping the bits, or similar electromagnetic effect). It can even be the result of a bug (buffer overflow). – Christophe Sep 29 '20 at 12:09
5

A bug is a mistake made by a software developer.

Corruption is not a mistake by a developer; it is when something alters the program after (or during) delivery — even something accidental/benign like failing storage or network transmission error.

Joel Coehoorn
  • 1,895
  • 4
  • 17
  • 22
2

Since 2003, the term corruption in software has also been associated with undesirable coupling between two software modules. DDD prescribes the creation of an anticorruption layer (ACL) between two software systems (or "bounded contexts" in DDD terms). If system A needs to interact with system B, and B's API uses different design standards, data structures and formats, an ACL may prevent elements of B's API to spread and "corrupt" components in A.

This use of the term "corruption" was clearly not the intent in the Qantas Flight 72 article, but it helps to clarify common terminology. Or so I hope.

Paulo Merson
  • 181
  • 1
  • 6