The Taiwan Semiconductor Manufacturing Company learned that the hard way in August. A third-party vendor shipped software to the chip maker without pre-screening it. An engineer at Taiwan Semiconductor failed to scan the software, which was infected with the WannaCry ransomware, installed it and then connected it to the company’s operating system. The undetected virus then spread.

The chief executive, C.C. Wei, speaking at a news conference at the time, rejected rumors of hacking. Instead, he acknowledged, it was “purely our own act of negligence.”

But the company was lucky. A full recovery took only a few days, and while initially it seemed that third-quarter revenue would be off by 2 percent, Elizabeth Sun, a company spokeswoman, said in an email that the revenues did not suffer because Taiwan Semiconductor fulfilled some of the delayed orders, while “increases in demand in other areas” helped to offset the losses.

Mondelez International and Merck suffered much more significant losses after the 2017 Notpetya attack, although they described them differently in filings.

In its annual report for 2017 filed with the Securities and Exchange Commission, Mondelez stated that the “malware affected a significant portion of our global sales, distribution and financial networks.” The net revenue loss, the company said, was less than 1 percent of the company’s global net revenues of $25.9 billion. That still amounts to $103.6 million. In addition, the company incurred “incremental expenses of $84 million predominantly during the second half of 2017 as part of the recovery effort.”