CINXE.COM

Integer overflow - Wikipedia

<!DOCTYPE html> <html class="client-nojs vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-sticky-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-feature-night-mode-enabled skin-theme-clientpref-day vector-toc-available" lang="en" dir="ltr"> <head> <meta charset="UTF-8"> <title>Integer overflow - Wikipedia</title> <script>(function(){var className="client-js vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-sticky-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-feature-night-mode-enabled skin-theme-clientpref-day vector-toc-available";var cookie=document.cookie.match(/(?:^|; )enwikimwclientpreferences=([^;]+)/);if(cookie){cookie[1].split('%2C').forEach(function(pref){className=className.replace(new RegExp('(^| )'+pref.replace(/-clientpref-\w+$|[^\w-]+/g,'')+'-clientpref-\\w+( |$)'),'$1'+pref+'$2');});}document.documentElement.className=className;}());RLCONF={"wgBreakFrames":false,"wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""],"wgDefaultDateFormat":"dmy", "wgMonthNames":["","January","February","March","April","May","June","July","August","September","October","November","December"],"wgRequestId":"ac44726c-cd0b-46dd-85cb-612adc3466ae","wgCanonicalNamespace":"","wgCanonicalSpecialPageName":false,"wgNamespaceNumber":0,"wgPageName":"Integer_overflow","wgTitle":"Integer overflow","wgCurRevisionId":1251625021,"wgRevisionId":1251625021,"wgArticleId":2151421,"wgIsArticle":true,"wgIsRedirect":false,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":["Articles with short description","Short description is different from Wikidata","Use American English from January 2019","All Wikipedia articles written in American English","Articles containing potentially dated statements from 2005","All articles containing potentially dated statements","Articles containing potentially dated statements from 2024","All articles lacking reliable references","Articles lacking reliable references from October 2024","Software bugs", "Computer security exploits","Computer arithmetic"],"wgPageViewLanguage":"en","wgPageContentLanguage":"en","wgPageContentModel":"wikitext","wgRelevantPageName":"Integer_overflow","wgRelevantArticleId":2151421,"wgIsProbablyEditable":true,"wgRelevantPageIsProbablyEditable":true,"wgRestrictionEdit":[],"wgRestrictionMove":[],"wgNoticeProject":"wikipedia","wgCiteReferencePreviewsActive":false,"wgFlaggedRevsParams":{"tags":{"status":{"levels":1}}},"wgMediaViewerOnClick":true,"wgMediaViewerEnabledByDefault":true,"wgPopupsFlags":0,"wgVisualEditor":{"pageLanguageCode":"en","pageLanguageDir":"ltr","pageVariantFallbacks":"en"},"wgMFDisplayWikibaseDescriptions":{"search":true,"watchlist":true,"tagline":false,"nearby":true},"wgWMESchemaEditAttemptStepOversample":false,"wgWMEPageLength":30000,"wgRelatedArticlesCompat":[],"wgCentralAuthMobileDomain":false,"wgEditSubmitButtonLabelPublish":true,"wgULSPosition":"interlanguage","wgULSisCompactLinksEnabled":false,"wgVector2022LanguageInHeader":true, "wgULSisLanguageSelectorEmpty":false,"wgWikibaseItemId":"Q1423448","wgCheckUserClientHintsHeadersJsApi":["brands","architecture","bitness","fullVersionList","mobile","model","platform","platformVersion"],"GEHomepageSuggestedEditsEnableTopics":true,"wgGETopicsMatchModeEnabled":false,"wgGEStructuredTaskRejectionReasonTextInputEnabled":false,"wgGELevelingUpEnabledForUser":false};RLSTATE={"ext.globalCssJs.user.styles":"ready","site.styles":"ready","user.styles":"ready","ext.globalCssJs.user":"ready","user":"ready","user.options":"loading","ext.cite.styles":"ready","skins.vector.search.codex.styles":"ready","skins.vector.styles":"ready","skins.vector.icons":"ready","ext.wikimediamessages.styles":"ready","ext.visualEditor.desktopArticleTarget.noscript":"ready","ext.uls.interlanguage":"ready","wikibase.client.init":"ready","ext.wikimediaBadges":"ready"};RLPAGEMODULES=["ext.cite.ux-enhancements","mediawiki.page.media","site","mediawiki.page.ready","mediawiki.toc","skins.vector.js", "ext.centralNotice.geoIP","ext.centralNotice.startUp","ext.gadget.ReferenceTooltips","ext.gadget.switcher","ext.urlShortener.toolbar","ext.centralauth.centralautologin","mmv.bootstrap","ext.popups","ext.visualEditor.desktopArticleTarget.init","ext.visualEditor.targetLoader","ext.echo.centralauth","ext.eventLogging","ext.wikimediaEvents","ext.navigationTiming","ext.uls.interface","ext.cx.eventlogging.campaigns","ext.cx.uls.quick.actions","wikibase.client.vector-2022","ext.checkUser.clientHints","ext.growthExperiments.SuggestedEditSession","wikibase.sidebar.tracking"];</script> <script>(RLQ=window.RLQ||[]).push(function(){mw.loader.impl(function(){return["user.options@12s5i",function($,jQuery,require,module){mw.user.tokens.set({"patrolToken":"+\\","watchToken":"+\\","csrfToken":"+\\"}); }];});});</script> <link rel="stylesheet" href="/w/load.php?lang=en&amp;modules=ext.cite.styles%7Cext.uls.interlanguage%7Cext.visualEditor.desktopArticleTarget.noscript%7Cext.wikimediaBadges%7Cext.wikimediamessages.styles%7Cskins.vector.icons%2Cstyles%7Cskins.vector.search.codex.styles%7Cwikibase.client.init&amp;only=styles&amp;skin=vector-2022"> <script async="" src="/w/load.php?lang=en&amp;modules=startup&amp;only=scripts&amp;raw=1&amp;skin=vector-2022"></script> <meta name="ResourceLoaderDynamicStyles" content=""> <link rel="stylesheet" href="/w/load.php?lang=en&amp;modules=site.styles&amp;only=styles&amp;skin=vector-2022"> <meta name="generator" content="MediaWiki 1.44.0-wmf.4"> <meta name="referrer" content="origin"> <meta name="referrer" content="origin-when-cross-origin"> <meta name="robots" content="max-image-preview:standard"> <meta name="format-detection" content="telephone=no"> <meta property="og:image" content="https://upload.wikimedia.org/wikipedia/commons/5/53/Odometer_rollover.jpg"> <meta property="og:image:width" content="1200"> <meta property="og:image:height" content="1098"> <meta property="og:image" content="https://upload.wikimedia.org/wikipedia/commons/5/53/Odometer_rollover.jpg"> <meta property="og:image:width" content="800"> <meta property="og:image:height" content="732"> <meta property="og:image:width" content="640"> <meta property="og:image:height" content="586"> <meta name="viewport" content="width=1120"> <meta property="og:title" content="Integer overflow - Wikipedia"> <meta property="og:type" content="website"> <link rel="preconnect" href="//upload.wikimedia.org"> <link rel="alternate" media="only screen and (max-width: 640px)" href="//en.m.wikipedia.org/wiki/Integer_overflow"> <link rel="alternate" type="application/x-wiki" title="Edit this page" href="/w/index.php?title=Integer_overflow&amp;action=edit"> <link rel="apple-touch-icon" href="/static/apple-touch/wikipedia.png"> <link rel="icon" href="/static/favicon/wikipedia.ico"> <link rel="search" type="application/opensearchdescription+xml" href="/w/rest.php/v1/search" title="Wikipedia (en)"> <link rel="EditURI" type="application/rsd+xml" href="//en.wikipedia.org/w/api.php?action=rsd"> <link rel="canonical" href="https://en.wikipedia.org/wiki/Integer_overflow"> <link rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en"> <link rel="alternate" type="application/atom+xml" title="Wikipedia Atom feed" href="/w/index.php?title=Special:RecentChanges&amp;feed=atom"> <link rel="dns-prefetch" href="//meta.wikimedia.org" /> <link rel="dns-prefetch" href="//login.wikimedia.org"> </head> <body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject mw-editable page-Integer_overflow rootpage-Integer_overflow skin-vector-2022 action-view"><a class="mw-jump-link" href="#bodyContent">Jump to content</a> <div class="vector-header-container"> <header class="vector-header mw-header"> <div class="vector-header-start"> <nav class="vector-main-menu-landmark" aria-label="Site"> <div id="vector-main-menu-dropdown" class="vector-dropdown vector-main-menu-dropdown vector-button-flush-left vector-button-flush-right" > <input type="checkbox" id="vector-main-menu-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-main-menu-dropdown" class="vector-dropdown-checkbox " aria-label="Main menu" > <label id="vector-main-menu-dropdown-label" for="vector-main-menu-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-menu mw-ui-icon-wikimedia-menu"></span> <span class="vector-dropdown-label-text">Main menu</span> </label> <div class="vector-dropdown-content"> <div id="vector-main-menu-unpinned-container" class="vector-unpinned-container"> <div id="vector-main-menu" class="vector-main-menu vector-pinnable-element"> <div class="vector-pinnable-header vector-main-menu-pinnable-header vector-pinnable-header-unpinned" data-feature-name="main-menu-pinned" data-pinnable-element-id="vector-main-menu" data-pinned-container-id="vector-main-menu-pinned-container" data-unpinned-container-id="vector-main-menu-unpinned-container" > <div class="vector-pinnable-header-label">Main menu</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-main-menu.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-main-menu.unpin">hide</button> </div> <div id="p-navigation" class="vector-menu mw-portlet mw-portlet-navigation" > <div class="vector-menu-heading"> Navigation </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-mainpage-description" class="mw-list-item"><a href="/wiki/Main_Page" title="Visit the main page [z]" accesskey="z"><span>Main page</span></a></li><li id="n-contents" class="mw-list-item"><a href="/wiki/Wikipedia:Contents" title="Guides to browsing Wikipedia"><span>Contents</span></a></li><li id="n-currentevents" class="mw-list-item"><a href="/wiki/Portal:Current_events" title="Articles related to current events"><span>Current events</span></a></li><li id="n-randompage" class="mw-list-item"><a href="/wiki/Special:Random" title="Visit a randomly selected article [x]" accesskey="x"><span>Random article</span></a></li><li id="n-aboutsite" class="mw-list-item"><a href="/wiki/Wikipedia:About" title="Learn about Wikipedia and how it works"><span>About Wikipedia</span></a></li><li id="n-contactpage" class="mw-list-item"><a href="//en.wikipedia.org/wiki/Wikipedia:Contact_us" title="How to contact Wikipedia"><span>Contact us</span></a></li> </ul> </div> </div> <div id="p-interaction" class="vector-menu mw-portlet mw-portlet-interaction" > <div class="vector-menu-heading"> Contribute </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-help" class="mw-list-item"><a href="/wiki/Help:Contents" title="Guidance on how to use and edit Wikipedia"><span>Help</span></a></li><li id="n-introduction" class="mw-list-item"><a href="/wiki/Help:Introduction" title="Learn how to edit Wikipedia"><span>Learn to edit</span></a></li><li id="n-portal" class="mw-list-item"><a href="/wiki/Wikipedia:Community_portal" title="The hub for editors"><span>Community portal</span></a></li><li id="n-recentchanges" class="mw-list-item"><a href="/wiki/Special:RecentChanges" title="A list of recent changes to Wikipedia [r]" accesskey="r"><span>Recent changes</span></a></li><li id="n-upload" class="mw-list-item"><a href="/wiki/Wikipedia:File_upload_wizard" title="Add images or other media for use on Wikipedia"><span>Upload file</span></a></li> </ul> </div> </div> </div> </div> </div> </div> </nav> <a href="/wiki/Main_Page" class="mw-logo"> <img class="mw-logo-icon" src="/static/images/icons/wikipedia.png" alt="" aria-hidden="true" height="50" width="50"> <span class="mw-logo-container skin-invert"> <img class="mw-logo-wordmark" alt="Wikipedia" src="/static/images/mobile/copyright/wikipedia-wordmark-en.svg" style="width: 7.5em; height: 1.125em;"> <img class="mw-logo-tagline" alt="The Free Encyclopedia" src="/static/images/mobile/copyright/wikipedia-tagline-en.svg" width="117" height="13" style="width: 7.3125em; height: 0.8125em;"> </span> </a> </div> <div class="vector-header-end"> <div id="p-search" role="search" class="vector-search-box-vue vector-search-box-collapses vector-search-box-show-thumbnail vector-search-box-auto-expand-width vector-search-box"> <a href="/wiki/Special:Search" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only search-toggle" title="Search Wikipedia [f]" accesskey="f"><span class="vector-icon mw-ui-icon-search mw-ui-icon-wikimedia-search"></span> <span>Search</span> </a> <div class="vector-typeahead-search-container"> <div class="cdx-typeahead-search cdx-typeahead-search--show-thumbnail cdx-typeahead-search--auto-expand-width"> <form action="/w/index.php" id="searchform" class="cdx-search-input cdx-search-input--has-end-button"> <div id="simpleSearch" class="cdx-search-input__input-wrapper" data-search-loc="header-moved"> <div class="cdx-text-input cdx-text-input--has-start-icon"> <input class="cdx-text-input__input" type="search" name="search" placeholder="Search Wikipedia" aria-label="Search Wikipedia" autocapitalize="sentences" title="Search Wikipedia [f]" accesskey="f" id="searchInput" > <span class="cdx-text-input__icon cdx-text-input__start-icon"></span> </div> <input type="hidden" name="title" value="Special:Search"> </div> <button class="cdx-button cdx-search-input__end-button">Search</button> </form> </div> </div> </div> <nav class="vector-user-links vector-user-links-wide" aria-label="Personal tools"> <div class="vector-user-links-main"> <div id="p-vector-user-menu-preferences" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <div id="p-vector-user-menu-userpage" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <nav class="vector-appearance-landmark" aria-label="Appearance"> <div id="vector-appearance-dropdown" class="vector-dropdown " title="Change the appearance of the page&#039;s font size, width, and color" > <input type="checkbox" id="vector-appearance-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-appearance-dropdown" class="vector-dropdown-checkbox " aria-label="Appearance" > <label id="vector-appearance-dropdown-label" for="vector-appearance-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-appearance mw-ui-icon-wikimedia-appearance"></span> <span class="vector-dropdown-label-text">Appearance</span> </label> <div class="vector-dropdown-content"> <div id="vector-appearance-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <div id="p-vector-user-menu-notifications" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <div id="p-vector-user-menu-overflow" class="vector-menu mw-portlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-sitesupport-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="https://donate.wikimedia.org/wiki/Special:FundraiserRedirector?utm_source=donate&amp;utm_medium=sidebar&amp;utm_campaign=C13_en.wikipedia.org&amp;uselang=en" class=""><span>Donate</span></a> </li> <li id="pt-createaccount-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="/w/index.php?title=Special:CreateAccount&amp;returnto=Integer+overflow" title="You are encouraged to create an account and log in; however, it is not mandatory" class=""><span>Create account</span></a> </li> <li id="pt-login-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="/w/index.php?title=Special:UserLogin&amp;returnto=Integer+overflow" title="You&#039;re encouraged to log in; however, it&#039;s not mandatory. [o]" accesskey="o" class=""><span>Log in</span></a> </li> </ul> </div> </div> </div> <div id="vector-user-links-dropdown" class="vector-dropdown vector-user-menu vector-button-flush-right vector-user-menu-logged-out" title="Log in and more options" > <input type="checkbox" id="vector-user-links-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-user-links-dropdown" class="vector-dropdown-checkbox " aria-label="Personal tools" > <label id="vector-user-links-dropdown-label" for="vector-user-links-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-ellipsis mw-ui-icon-wikimedia-ellipsis"></span> <span class="vector-dropdown-label-text">Personal tools</span> </label> <div class="vector-dropdown-content"> <div id="p-personal" class="vector-menu mw-portlet mw-portlet-personal user-links-collapsible-item" title="User menu" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-sitesupport" class="user-links-collapsible-item mw-list-item"><a href="https://donate.wikimedia.org/wiki/Special:FundraiserRedirector?utm_source=donate&amp;utm_medium=sidebar&amp;utm_campaign=C13_en.wikipedia.org&amp;uselang=en"><span>Donate</span></a></li><li id="pt-createaccount" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Special:CreateAccount&amp;returnto=Integer+overflow" title="You are encouraged to create an account and log in; however, it is not mandatory"><span class="vector-icon mw-ui-icon-userAdd mw-ui-icon-wikimedia-userAdd"></span> <span>Create account</span></a></li><li id="pt-login" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Special:UserLogin&amp;returnto=Integer+overflow" title="You&#039;re encouraged to log in; however, it&#039;s not mandatory. [o]" accesskey="o"><span class="vector-icon mw-ui-icon-logIn mw-ui-icon-wikimedia-logIn"></span> <span>Log in</span></a></li> </ul> </div> </div> <div id="p-user-menu-anon-editor" class="vector-menu mw-portlet mw-portlet-user-menu-anon-editor" > <div class="vector-menu-heading"> Pages for logged out editors <a href="/wiki/Help:Introduction" aria-label="Learn more about editing"><span>learn more</span></a> </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-anoncontribs" class="mw-list-item"><a href="/wiki/Special:MyContributions" title="A list of edits made from this IP address [y]" accesskey="y"><span>Contributions</span></a></li><li id="pt-anontalk" class="mw-list-item"><a href="/wiki/Special:MyTalk" title="Discussion about edits from this IP address [n]" accesskey="n"><span>Talk</span></a></li> </ul> </div> </div> </div> </div> </nav> </div> </header> </div> <div class="mw-page-container"> <div class="mw-page-container-inner"> <div class="vector-sitenotice-container"> <div id="siteNotice"><!-- CentralNotice --></div> </div> <div class="vector-column-start"> <div class="vector-main-menu-container"> <div id="mw-navigation"> <nav id="mw-panel" class="vector-main-menu-landmark" aria-label="Site"> <div id="vector-main-menu-pinned-container" class="vector-pinned-container"> </div> </nav> </div> </div> <div class="vector-sticky-pinned-container"> <nav id="mw-panel-toc" aria-label="Contents" data-event-name="ui.sidebar-toc" class="mw-table-of-contents-container vector-toc-landmark"> <div id="vector-toc-pinned-container" class="vector-pinned-container"> <div id="vector-toc" class="vector-toc vector-pinnable-element"> <div class="vector-pinnable-header vector-toc-pinnable-header vector-pinnable-header-pinned" data-feature-name="toc-pinned" data-pinnable-element-id="vector-toc" > <h2 class="vector-pinnable-header-label">Contents</h2> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-toc.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-toc.unpin">hide</button> </div> <ul class="vector-toc-contents" id="mw-panel-toc-list"> <li id="toc-mw-content-text" class="vector-toc-list-item vector-toc-level-1"> <a href="#" class="vector-toc-link"> <div class="vector-toc-text">(Top)</div> </a> </li> <li id="toc-Origin" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Origin"> <div class="vector-toc-text"> <span class="vector-toc-numb">1</span> <span>Origin</span> </div> </a> <ul id="toc-Origin-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Flags" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Flags"> <div class="vector-toc-text"> <span class="vector-toc-numb">2</span> <span>Flags</span> </div> </a> <ul id="toc-Flags-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Definition_variations_and_ambiguity" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Definition_variations_and_ambiguity"> <div class="vector-toc-text"> <span class="vector-toc-numb">3</span> <span>Definition variations and ambiguity</span> </div> </a> <ul id="toc-Definition_variations_and_ambiguity-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Inconsistent_behavior" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Inconsistent_behavior"> <div class="vector-toc-text"> <span class="vector-toc-numb">4</span> <span>Inconsistent behavior</span> </div> </a> <ul id="toc-Inconsistent_behavior-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Methods_to_address_integer_overflow_problems" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Methods_to_address_integer_overflow_problems"> <div class="vector-toc-text"> <span class="vector-toc-numb">5</span> <span>Methods to address integer overflow problems</span> </div> </a> <button aria-controls="toc-Methods_to_address_integer_overflow_problems-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle Methods to address integer overflow problems subsection</span> </button> <ul id="toc-Methods_to_address_integer_overflow_problems-sublist" class="vector-toc-list"> <li id="toc-Detection" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Detection"> <div class="vector-toc-text"> <span class="vector-toc-numb">5.1</span> <span>Detection</span> </div> </a> <ul id="toc-Detection-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Avoidance" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Avoidance"> <div class="vector-toc-text"> <span class="vector-toc-numb">5.2</span> <span>Avoidance</span> </div> </a> <ul id="toc-Avoidance-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Handling" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Handling"> <div class="vector-toc-text"> <span class="vector-toc-numb">5.3</span> <span>Handling</span> </div> </a> <ul id="toc-Handling-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Programming_language_support" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Programming_language_support"> <div class="vector-toc-text"> <span class="vector-toc-numb">5.4</span> <span>Programming language support</span> </div> </a> <ul id="toc-Programming_language_support-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Saturated_arithmetic" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Saturated_arithmetic"> <div class="vector-toc-text"> <span class="vector-toc-numb">5.5</span> <span>Saturated arithmetic</span> </div> </a> <ul id="toc-Saturated_arithmetic-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Examples" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Examples"> <div class="vector-toc-text"> <span class="vector-toc-numb">6</span> <span>Examples</span> </div> </a> <ul id="toc-Examples-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-See_also" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#See_also"> <div class="vector-toc-text"> <span class="vector-toc-numb">7</span> <span>See also</span> </div> </a> <ul id="toc-See_also-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-References" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#References"> <div class="vector-toc-text"> <span class="vector-toc-numb">8</span> <span>References</span> </div> </a> <ul id="toc-References-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-External_links" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#External_links"> <div class="vector-toc-text"> <span class="vector-toc-numb">9</span> <span>External links</span> </div> </a> <ul id="toc-External_links-sublist" class="vector-toc-list"> </ul> </li> </ul> </div> </div> </nav> </div> </div> <div class="mw-content-container"> <main id="content" class="mw-body"> <header class="mw-body-header vector-page-titlebar"> <nav aria-label="Contents" class="vector-toc-landmark"> <div id="vector-page-titlebar-toc" class="vector-dropdown vector-page-titlebar-toc vector-button-flush-left" > <input type="checkbox" id="vector-page-titlebar-toc-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-page-titlebar-toc" class="vector-dropdown-checkbox " aria-label="Toggle the table of contents" > <label id="vector-page-titlebar-toc-label" for="vector-page-titlebar-toc-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-listBullet mw-ui-icon-wikimedia-listBullet"></span> <span class="vector-dropdown-label-text">Toggle the table of contents</span> </label> <div class="vector-dropdown-content"> <div id="vector-page-titlebar-toc-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <h1 id="firstHeading" class="firstHeading mw-first-heading"><span class="mw-page-title-main">Integer overflow</span></h1> <div id="p-lang-btn" class="vector-dropdown mw-portlet mw-portlet-lang" > <input type="checkbox" id="p-lang-btn-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-p-lang-btn" class="vector-dropdown-checkbox mw-interlanguage-selector" aria-label="Go to an article in another language. Available in 15 languages" > <label id="p-lang-btn-label" for="p-lang-btn-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--action-progressive mw-portlet-lang-heading-15" aria-hidden="true" ><span class="vector-icon mw-ui-icon-language-progressive mw-ui-icon-wikimedia-language-progressive"></span> <span class="vector-dropdown-label-text">15 languages</span> </label> <div class="vector-dropdown-content"> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li class="interlanguage-link interwiki-ar mw-list-item"><a href="https://ar.wikipedia.org/wiki/%D8%B7%D9%81%D8%AD_%D8%B9%D8%AF%D8%AF_%D8%B5%D8%AD%D9%8A%D8%AD" title="طفح عدد صحيح – Arabic" lang="ar" hreflang="ar" data-title="طفح عدد صحيح" data-language-autonym="العربية" data-language-local-name="Arabic" class="interlanguage-link-target"><span>العربية</span></a></li><li class="interlanguage-link interwiki-de mw-list-item"><a href="https://de.wikipedia.org/wiki/Arithmetischer_%C3%9Cberlauf" title="Arithmetischer Überlauf – German" lang="de" hreflang="de" data-title="Arithmetischer Überlauf" data-language-autonym="Deutsch" data-language-local-name="German" class="interlanguage-link-target"><span>Deutsch</span></a></li><li class="interlanguage-link interwiki-es badge-Q70893996 mw-list-item" title=""><a href="https://es.wikipedia.org/wiki/Desbordamiento_de_enteros" title="Desbordamiento de enteros – Spanish" lang="es" hreflang="es" data-title="Desbordamiento de enteros" data-language-autonym="Español" data-language-local-name="Spanish" class="interlanguage-link-target"><span>Español</span></a></li><li class="interlanguage-link interwiki-fa mw-list-item"><a href="https://fa.wikipedia.org/wiki/%D8%B3%D8%B1%D8%B1%DB%8C%D8%B2_%D8%B9%D8%AF%D8%AF_%D8%B5%D8%AD%DB%8C%D8%AD" title="سرریز عدد صحیح – Persian" lang="fa" hreflang="fa" data-title="سرریز عدد صحیح" data-language-autonym="فارسی" data-language-local-name="Persian" class="interlanguage-link-target"><span>فارسی</span></a></li><li class="interlanguage-link interwiki-fr mw-list-item"><a href="https://fr.wikipedia.org/wiki/D%C3%A9passement_d%27entier" title="Dépassement d&#039;entier – French" lang="fr" hreflang="fr" data-title="Dépassement d&#039;entier" data-language-autonym="Français" data-language-local-name="French" class="interlanguage-link-target"><span>Français</span></a></li><li class="interlanguage-link interwiki-ko mw-list-item"><a href="https://ko.wikipedia.org/wiki/%EC%A0%95%EC%88%98_%EC%98%A4%EB%B2%84%ED%94%8C%EB%A1%9C" title="정수 오버플로 – Korean" lang="ko" hreflang="ko" data-title="정수 오버플로" data-language-autonym="한국어" data-language-local-name="Korean" class="interlanguage-link-target"><span>한국어</span></a></li><li class="interlanguage-link interwiki-he mw-list-item"><a href="https://he.wikipedia.org/wiki/%D7%92%D7%9C%D7%99%D7%A9%D7%AA_%D7%9E%D7%A1%D7%A4%D7%A8" title="גלישת מספר – Hebrew" lang="he" hreflang="he" data-title="גלישת מספר" data-language-autonym="עברית" data-language-local-name="Hebrew" class="interlanguage-link-target"><span>עברית</span></a></li><li class="interlanguage-link interwiki-no mw-list-item"><a href="https://no.wikipedia.org/wiki/Heltallsoverflyt" title="Heltallsoverflyt – Norwegian Bokmål" lang="nb" hreflang="nb" data-title="Heltallsoverflyt" data-language-autonym="Norsk bokmål" data-language-local-name="Norwegian Bokmål" class="interlanguage-link-target"><span>Norsk bokmål</span></a></li><li class="interlanguage-link interwiki-pl mw-list-item"><a href="https://pl.wikipedia.org/wiki/Przekroczenie_zakresu_liczb_ca%C5%82kowitych" title="Przekroczenie zakresu liczb całkowitych – Polish" lang="pl" hreflang="pl" data-title="Przekroczenie zakresu liczb całkowitych" data-language-autonym="Polski" data-language-local-name="Polish" class="interlanguage-link-target"><span>Polski</span></a></li><li class="interlanguage-link interwiki-ru mw-list-item"><a href="https://ru.wikipedia.org/wiki/%D0%A6%D0%B5%D0%BB%D0%BE%D1%87%D0%B8%D1%81%D0%BB%D0%B5%D0%BD%D0%BD%D0%BE%D0%B5_%D0%BF%D0%B5%D1%80%D0%B5%D0%BF%D0%BE%D0%BB%D0%BD%D0%B5%D0%BD%D0%B8%D0%B5" title="Целочисленное переполнение – Russian" lang="ru" hreflang="ru" data-title="Целочисленное переполнение" data-language-autonym="Русский" data-language-local-name="Russian" class="interlanguage-link-target"><span>Русский</span></a></li><li class="interlanguage-link interwiki-simple mw-list-item"><a href="https://simple.wikipedia.org/wiki/Integer_overflow" title="Integer overflow – Simple English" lang="en-simple" hreflang="en-simple" data-title="Integer overflow" data-language-autonym="Simple English" data-language-local-name="Simple English" class="interlanguage-link-target"><span>Simple English</span></a></li><li class="interlanguage-link interwiki-uk mw-list-item"><a href="https://uk.wikipedia.org/wiki/%D0%A6%D1%96%D0%BB%D0%BE%D1%87%D0%B8%D1%81%D0%B5%D0%BB%D1%8C%D0%BD%D0%B5_%D0%BF%D0%B5%D1%80%D0%B5%D0%BF%D0%BE%D0%B2%D0%BD%D0%B5%D0%BD%D0%BD%D1%8F" title="Цілочисельне переповнення – Ukrainian" lang="uk" hreflang="uk" data-title="Цілочисельне переповнення" data-language-autonym="Українська" data-language-local-name="Ukrainian" class="interlanguage-link-target"><span>Українська</span></a></li><li class="interlanguage-link interwiki-vi mw-list-item"><a href="https://vi.wikipedia.org/wiki/Tr%C3%A0n_s%E1%BB%91_nguy%C3%AAn" title="Tràn số nguyên – Vietnamese" lang="vi" hreflang="vi" data-title="Tràn số nguyên" data-language-autonym="Tiếng Việt" data-language-local-name="Vietnamese" class="interlanguage-link-target"><span>Tiếng Việt</span></a></li><li class="interlanguage-link interwiki-zh-yue mw-list-item"><a href="https://zh-yue.wikipedia.org/wiki/%E6%95%B4%E6%95%B8%E9%81%8E%E6%BA%A2" title="整數過溢 – Cantonese" lang="yue" hreflang="yue" data-title="整數過溢" data-language-autonym="粵語" data-language-local-name="Cantonese" class="interlanguage-link-target"><span>粵語</span></a></li><li class="interlanguage-link interwiki-zh mw-list-item"><a href="https://zh.wikipedia.org/wiki/%E6%95%B4%E6%95%B0%E6%BA%A2%E5%87%BA" title="整数溢出 – Chinese" lang="zh" hreflang="zh" data-title="整数溢出" data-language-autonym="中文" data-language-local-name="Chinese" class="interlanguage-link-target"><span>中文</span></a></li> </ul> <div class="after-portlet after-portlet-lang"><span class="wb-langlinks-edit wb-langlinks-link"><a href="https://www.wikidata.org/wiki/Special:EntityPage/Q1423448#sitelinks-wikipedia" title="Edit interlanguage links" class="wbc-editpage">Edit links</a></span></div> </div> </div> </div> </header> <div class="vector-page-toolbar"> <div class="vector-page-toolbar-container"> <div id="left-navigation"> <nav aria-label="Namespaces"> <div id="p-associated-pages" class="vector-menu vector-menu-tabs mw-portlet mw-portlet-associated-pages" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-nstab-main" class="selected vector-tab-noicon mw-list-item"><a href="/wiki/Integer_overflow" title="View the content page [c]" accesskey="c"><span>Article</span></a></li><li id="ca-talk" class="vector-tab-noicon mw-list-item"><a href="/wiki/Talk:Integer_overflow" rel="discussion" title="Discuss improvements to the content page [t]" accesskey="t"><span>Talk</span></a></li> </ul> </div> </div> <div id="vector-variants-dropdown" class="vector-dropdown emptyPortlet" > <input type="checkbox" id="vector-variants-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-variants-dropdown" class="vector-dropdown-checkbox " aria-label="Change language variant" > <label id="vector-variants-dropdown-label" for="vector-variants-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet" aria-hidden="true" ><span class="vector-dropdown-label-text">English</span> </label> <div class="vector-dropdown-content"> <div id="p-variants" class="vector-menu mw-portlet mw-portlet-variants emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> </div> </div> </nav> </div> <div id="right-navigation" class="vector-collapsible"> <nav aria-label="Views"> <div id="p-views" class="vector-menu vector-menu-tabs mw-portlet mw-portlet-views" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-view" class="selected vector-tab-noicon mw-list-item"><a href="/wiki/Integer_overflow"><span>Read</span></a></li><li id="ca-edit" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Integer_overflow&amp;action=edit" title="Edit this page [e]" accesskey="e"><span>Edit</span></a></li><li id="ca-history" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Integer_overflow&amp;action=history" title="Past revisions of this page [h]" accesskey="h"><span>View history</span></a></li> </ul> </div> </div> </nav> <nav class="vector-page-tools-landmark" aria-label="Page tools"> <div id="vector-page-tools-dropdown" class="vector-dropdown vector-page-tools-dropdown" > <input type="checkbox" id="vector-page-tools-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-page-tools-dropdown" class="vector-dropdown-checkbox " aria-label="Tools" > <label id="vector-page-tools-dropdown-label" for="vector-page-tools-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet" aria-hidden="true" ><span class="vector-dropdown-label-text">Tools</span> </label> <div class="vector-dropdown-content"> <div id="vector-page-tools-unpinned-container" class="vector-unpinned-container"> <div id="vector-page-tools" class="vector-page-tools vector-pinnable-element"> <div class="vector-pinnable-header vector-page-tools-pinnable-header vector-pinnable-header-unpinned" data-feature-name="page-tools-pinned" data-pinnable-element-id="vector-page-tools" data-pinned-container-id="vector-page-tools-pinned-container" data-unpinned-container-id="vector-page-tools-unpinned-container" > <div class="vector-pinnable-header-label">Tools</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-page-tools.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-page-tools.unpin">hide</button> </div> <div id="p-cactions" class="vector-menu mw-portlet mw-portlet-cactions emptyPortlet vector-has-collapsible-items" title="More options" > <div class="vector-menu-heading"> Actions </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-more-view" class="selected vector-more-collapsible-item mw-list-item"><a href="/wiki/Integer_overflow"><span>Read</span></a></li><li id="ca-more-edit" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Integer_overflow&amp;action=edit" title="Edit this page [e]" accesskey="e"><span>Edit</span></a></li><li id="ca-more-history" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Integer_overflow&amp;action=history"><span>View history</span></a></li> </ul> </div> </div> <div id="p-tb" class="vector-menu mw-portlet mw-portlet-tb" > <div class="vector-menu-heading"> General </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="t-whatlinkshere" class="mw-list-item"><a href="/wiki/Special:WhatLinksHere/Integer_overflow" title="List of all English Wikipedia pages containing links to this page [j]" accesskey="j"><span>What links here</span></a></li><li id="t-recentchangeslinked" class="mw-list-item"><a href="/wiki/Special:RecentChangesLinked/Integer_overflow" rel="nofollow" title="Recent changes in pages linked from this page [k]" accesskey="k"><span>Related changes</span></a></li><li id="t-upload" class="mw-list-item"><a href="/wiki/Wikipedia:File_Upload_Wizard" title="Upload files [u]" accesskey="u"><span>Upload file</span></a></li><li id="t-specialpages" class="mw-list-item"><a href="/wiki/Special:SpecialPages" title="A list of all special pages [q]" accesskey="q"><span>Special pages</span></a></li><li id="t-permalink" class="mw-list-item"><a href="/w/index.php?title=Integer_overflow&amp;oldid=1251625021" title="Permanent link to this revision of this page"><span>Permanent link</span></a></li><li id="t-info" class="mw-list-item"><a href="/w/index.php?title=Integer_overflow&amp;action=info" title="More information about this page"><span>Page information</span></a></li><li id="t-cite" class="mw-list-item"><a href="/w/index.php?title=Special:CiteThisPage&amp;page=Integer_overflow&amp;id=1251625021&amp;wpFormIdentifier=titleform" title="Information on how to cite this page"><span>Cite this page</span></a></li><li id="t-urlshortener" class="mw-list-item"><a href="/w/index.php?title=Special:UrlShortener&amp;url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FInteger_overflow"><span>Get shortened URL</span></a></li><li id="t-urlshortener-qrcode" class="mw-list-item"><a href="/w/index.php?title=Special:QrCode&amp;url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FInteger_overflow"><span>Download QR code</span></a></li> </ul> </div> </div> <div id="p-coll-print_export" class="vector-menu mw-portlet mw-portlet-coll-print_export" > <div class="vector-menu-heading"> Print/export </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="coll-download-as-rl" class="mw-list-item"><a href="/w/index.php?title=Special:DownloadAsPdf&amp;page=Integer_overflow&amp;action=show-download-screen" title="Download this page as a PDF file"><span>Download as PDF</span></a></li><li id="t-print" class="mw-list-item"><a href="/w/index.php?title=Integer_overflow&amp;printable=yes" title="Printable version of this page [p]" accesskey="p"><span>Printable version</span></a></li> </ul> </div> </div> <div id="p-wikibase-otherprojects" class="vector-menu mw-portlet mw-portlet-wikibase-otherprojects" > <div class="vector-menu-heading"> In other projects </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="t-wikibase" class="wb-otherproject-link wb-otherproject-wikibase-dataitem mw-list-item"><a href="https://www.wikidata.org/wiki/Special:EntityPage/Q1423448" title="Structured data on this page hosted by Wikidata [g]" accesskey="g"><span>Wikidata item</span></a></li> </ul> </div> </div> </div> </div> </div> </div> </nav> </div> </div> </div> <div class="vector-column-end"> <div class="vector-sticky-pinned-container"> <nav class="vector-page-tools-landmark" aria-label="Page tools"> <div id="vector-page-tools-pinned-container" class="vector-pinned-container"> </div> </nav> <nav class="vector-appearance-landmark" aria-label="Appearance"> <div id="vector-appearance-pinned-container" class="vector-pinned-container"> <div id="vector-appearance" class="vector-appearance vector-pinnable-element"> <div class="vector-pinnable-header vector-appearance-pinnable-header vector-pinnable-header-pinned" data-feature-name="appearance-pinned" data-pinnable-element-id="vector-appearance" data-pinned-container-id="vector-appearance-pinned-container" data-unpinned-container-id="vector-appearance-unpinned-container" > <div class="vector-pinnable-header-label">Appearance</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-appearance.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-appearance.unpin">hide</button> </div> </div> </div> </nav> </div> </div> <div id="bodyContent" class="vector-body" aria-labelledby="firstHeading" data-mw-ve-target-container> <div class="vector-body-before-content"> <div class="mw-indicators"> </div> <div id="siteSub" class="noprint">From Wikipedia, the free encyclopedia</div> </div> <div id="contentSub"><div id="mw-content-subtitle"></div></div> <div id="mw-content-text" class="mw-body-content"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr"><div class="shortdescription nomobile noexcerpt noprint searchaux" style="display:none">Computer arithmetic error</div> <p class="mw-empty-elt"> </p> <figure typeof="mw:File/Thumb"><a href="/wiki/File:Odometer_rollover.jpg" class="mw-file-description"><img src="//upload.wikimedia.org/wikipedia/commons/thumb/5/53/Odometer_rollover.jpg/250px-Odometer_rollover.jpg" decoding="async" width="250" height="229" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/5/53/Odometer_rollover.jpg/375px-Odometer_rollover.jpg 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/5/53/Odometer_rollover.jpg/500px-Odometer_rollover.jpg 2x" data-file-width="600" data-file-height="549" /></a><figcaption>Integer overflow can be demonstrated through an <a href="/wiki/Odometer" title="Odometer">odometer</a> overflowing, a mechanical version of the phenomenon. All digits are set to the maximum 9 and the next increment of the white digit causes a cascade of carry-over additions setting all digits to 0, but there is no higher digit (1,000,000s digit) to change to a 1, so the counter resets to zero. This is <i>wrapping</i> in contrast to <i>saturating</i>.</figcaption></figure> <p>In <a href="/wiki/Computer_programming" title="Computer programming">computer programming</a>, an <b>integer overflow</b> occurs when an <a href="/wiki/Arithmetic" title="Arithmetic">arithmetic</a> operation on integers attempts to create a numeric value that is outside of the range that can be represented with a given number of digits – either higher than the maximum or lower than the minimum representable value. </p><p>The most common result of an overflow is that the least significant representable digits of the result are stored; the result is said to <i>wrap</i> around the maximum (i.e. <a href="/wiki/Modular_arithmetic" title="Modular arithmetic">modulo</a> a power of the <a href="/wiki/Radix" title="Radix">radix</a>, usually two in modern computers, but sometimes ten or other number). On some processors like <a href="/wiki/Graphics_processing_unit" title="Graphics processing unit">graphics processing units</a> (GPUs) and <a href="/wiki/Digital_signal_processor" title="Digital signal processor">digital signal processors</a> (DSPs) which support <a href="/wiki/Saturation_arithmetic" title="Saturation arithmetic">saturation arithmetic</a>, overflowed results would be <i>clamped</i>, i.e. set to the minimum value in the representable range if the result is below the minimum and set to the maximum value in the representable range if the result is above the maximum, rather than wrapped around. </p><p>An overflow condition may give results leading to unintended behavior. In particular, if the possibility has not been anticipated, overflow can compromise a program's reliability and <a href="/wiki/Software_security" class="mw-redirect" title="Software security">security</a>. </p><p>For some applications, such as timers and clocks, wrapping on overflow can be desirable. The <a href="/wiki/C11_(C_standard_revision)" title="C11 (C standard revision)">C11 standard</a> states that for unsigned integers, modulo wrapping is the defined behavior and the term overflow never applies: "a computation involving unsigned operands can never overflow."<sup id="cite_ref-auto_1-0" class="reference"><a href="#cite_note-auto-1"><span class="cite-bracket">&#91;</span>1<span class="cite-bracket">&#93;</span></a></sup> </p> <meta property="mw:PageProp/toc" /> <div class="mw-heading mw-heading2"><h2 id="Origin">Origin</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Integer_overflow&amp;action=edit&amp;section=1" title="Edit section: Origin"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The <a href="/wiki/Register_width" class="mw-redirect" title="Register width">register width</a> of a processor determines the range of values that can be represented in its registers. Though the vast majority of computers can perform multiple-precision arithmetic on operands in memory, allowing numbers to be arbitrarily long and overflow to be avoided, the register width limits the sizes of numbers that can be operated on (e.g., added or subtracted) using a single <a href="/wiki/Instruction_set_architecture#Instructions" title="Instruction set architecture">instruction</a> per operation. Typical <a href="/wiki/Binary_numeral_system" class="mw-redirect" title="Binary numeral system">binary</a> register widths for unsigned integers include: </p> <ul><li><a href="/wiki/4-bit_computing" title="4-bit computing">4-bit</a>: maximum representable value 2<sup>4</sup> − 1 = 15</li> <li><a href="/wiki/8-bit_computing" title="8-bit computing">8-bit</a>: maximum representable value 2<sup>8</sup> − 1 = 255</li> <li><a href="/wiki/16-bit_computing" title="16-bit computing">16-bit</a>: maximum representable value 2<sup>16</sup> − 1 = 65,535</li> <li><a href="/wiki/32-bit_computing" title="32-bit computing">32-bit</a>: maximum representable value 2<sup>32</sup> − 1 = 4,294,967,295 (the most common width for personal computers as of 2005<sup class="plainlinks noexcerpt noprint asof-tag update" style="display:none;"><a class="external text" href="https://en.wikipedia.org/w/index.php?title=Integer_overflow&amp;action=edit">&#91;update&#93;</a></sup>),</li> <li><a href="/wiki/64-bit_computing" title="64-bit computing">64-bit</a>: maximum representable value 2<sup>64</sup> − 1 = 18,446,744,073,709,551,615 (the most common width for personal computer <a href="/wiki/Central_processing_unit" title="Central processing unit">central processing units</a> (CPUs), as of 2024<sup class="plainlinks noexcerpt noprint asof-tag update" style="display:none;"><a class="external text" href="https://en.wikipedia.org/w/index.php?title=Integer_overflow&amp;action=edit">&#91;update&#93;</a></sup>),</li> <li><a href="/wiki/128-bit_computing" title="128-bit computing">128-bit</a>: maximum representable value 2<sup>128</sup> − 1 = 340,282,366,920,938,463,463,374,607,431,768,211,455</li></ul> <p>When an unsigned arithmetic operation produces a result larger than the maximum above for an N-bit integer, an overflow reduces the result to <a href="/wiki/Modulo_operation" class="mw-redirect" title="Modulo operation">modulo</a> N-th power of 2, retaining only the least significant bits of the result and effectively causing a <i>wrap around</i>. </p><p>In particular, multiplying or adding two integers may result in a value that is unexpectedly small, and subtracting from a small integer may cause a wrap to a large positive value (for example, 8-bit integer addition 255 + 2 results in 1, which is <span class="texhtml">257 mod 2<sup>8</sup></span>, and similarly subtraction 0 − 1 results in 255, a <a href="/wiki/Two%27s_complement" title="Two&#39;s complement">two's complement</a> representation of −1). </p><p><span class="anchor" id="Security_ramifications"></span> Such wraparound may cause security detriments&#8212;if an overflowed value is used as the number of bytes to allocate for a buffer, the buffer will be allocated unexpectedly small, potentially leading to a <a href="/wiki/Buffer_overflow" title="Buffer overflow">buffer overflow</a> which, depending on the use of the buffer, might in turn cause arbitrary code execution. </p><p>If the variable has a <a href="/wiki/Signed_number_representations" title="Signed number representations">signed integer</a> type, a program may make the assumption that a variable always contains a positive value. An integer overflow can cause the value to wrap and become negative, which violates the program's assumption and may lead to unexpected behavior (for example, 8-bit integer addition of 127 + 1 results in −128, a two's complement of 128). (A solution for this particular problem is to use unsigned integer types for values that a program expects and assumes will never be negative.) </p> <div class="mw-heading mw-heading2"><h2 id="Flags">Flags</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Integer_overflow&amp;action=edit&amp;section=2" title="Edit section: Flags"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Most computers have two dedicated processor flags to check for overflow conditions. </p><p>The <a href="/wiki/Carry_flag" title="Carry flag">carry flag</a> is set when the result of an addition or subtraction, considering the operands and result as unsigned numbers, does not fit in the given number of bits. This indicates an overflow with a <a href="/wiki/Carry_(arithmetic)" title="Carry (arithmetic)"><i>carry</i> or <i>borrow</i></a> from the <a href="/wiki/Most_significant_bit" class="mw-redirect" title="Most significant bit">most significant bit</a>. An immediately following <i>add with carry</i> or <i>subtract with borrow</i> operation would use the contents of this flag to modify a register or a memory location that contains the higher part of a multi-word value. </p><p>The <a href="/wiki/Overflow_flag" title="Overflow flag">overflow flag</a> is set when the result of an operation on signed numbers does not have the sign that one would predict from the signs of the operands, e.g., a negative result when adding two positive numbers. This indicates that an overflow has occurred and the signed result represented in <a href="/wiki/Two%27s_complement" title="Two&#39;s complement">two's complement</a> form would not fit in the given number of bits. </p> <div class="mw-heading mw-heading2"><h2 id="Definition_variations_and_ambiguity">Definition variations and ambiguity</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Integer_overflow&amp;action=edit&amp;section=3" title="Edit section: Definition variations and ambiguity"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>For an unsigned type, when the ideal result of an operation is outside the type's representable range and the returned result is obtained by wrapping, then this event is commonly defined as an overflow. In contrast, the C11 standard defines that this event is not an overflow and states "a computation involving unsigned operands can never overflow."<sup id="cite_ref-auto_1-1" class="reference"><a href="#cite_note-auto-1"><span class="cite-bracket">&#91;</span>1<span class="cite-bracket">&#93;</span></a></sup> </p><p>When the ideal result of an integer operation is outside the type's representable range and the returned result is obtained by clamping, then this event is commonly defined as a saturation. Use varies as to whether a saturation is or is not an overflow. To eliminate ambiguity, the terms wrapping overflow<sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">&#91;</span>2<span class="cite-bracket">&#93;</span></a></sup> and saturating overflow<sup id="cite_ref-3" class="reference"><a href="#cite_note-3"><span class="cite-bracket">&#91;</span>3<span class="cite-bracket">&#93;</span></a></sup> can be used. </p><p>Many references can be found to integer underflow.<sup id="cite_ref-4" class="reference"><a href="#cite_note-4"><span class="cite-bracket">&#91;</span>4<span class="cite-bracket">&#93;</span></a></sup><sup id="cite_ref-5" class="reference"><a href="#cite_note-5"><span class="cite-bracket">&#91;</span>5<span class="cite-bracket">&#93;</span></a></sup><sup id="cite_ref-6" class="reference"><a href="#cite_note-6"><span class="cite-bracket">&#91;</span>6<span class="cite-bracket">&#93;</span></a></sup><sup id="cite_ref-7" class="reference"><a href="#cite_note-7"><span class="cite-bracket">&#91;</span>7<span class="cite-bracket">&#93;</span></a></sup><sup id="cite_ref-8" class="reference"><a href="#cite_note-8"><span class="cite-bracket">&#91;</span>8<span class="cite-bracket">&#93;</span></a></sup> When the term integer underflow is used, it means the ideal result was closer to negative infinity than the output type's representable value closest to negative infinity. Depending on context, the definition of overflow may include all types including underflows, or it may only include cases where the ideal result was closer to positive infinity than the output type's representable value closest to positive infinity. </p><p>When the ideal result of an operation is not an exact integer, the meaning of overflow can be ambiguous in edge cases. Consider the case where the ideal result has a value of 127.25 and the output type's maximum representable value is 127. If overflow is defined as the ideal value being outside the representable range of the output type, then this case would be classified as an overflow. For operations that have well defined rounding behavior, overflow classification may need to be postponed until after rounding is applied. The C11 standard<sup id="cite_ref-auto_1-2" class="reference"><a href="#cite_note-auto-1"><span class="cite-bracket">&#91;</span>1<span class="cite-bracket">&#93;</span></a></sup> defines that conversions from floating point to integer must round toward zero. If C is used to convert the floating point value 127.25 to integer, then rounding should be applied first to give an ideal integer output of 127. Since the rounded integer is in the outputs range, the C standard would not classify this conversion as an overflow. </p> <div class="mw-heading mw-heading2"><h2 id="Inconsistent_behavior">Inconsistent behavior</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Integer_overflow&amp;action=edit&amp;section=4" title="Edit section: Inconsistent behavior"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The behavior on occurrence of overflow may not be consistent in all circumstances. For example, in the language <a href="/wiki/Rust_(programming_language)" title="Rust (programming language)">Rust</a>, while functionality is provided to give users choice and control, the behavior for basic use of mathematic operators is naturally fixed; however, this fixed behavior differs between a program built in 'debug' mode and one built in 'release' mode.<sup id="cite_ref-9" class="reference"><a href="#cite_note-9"><span class="cite-bracket">&#91;</span>9<span class="cite-bracket">&#93;</span></a></sup> In C, unsigned integer overflow is defined to wrap around, while signed integer overflow causes <a href="/wiki/Undefined_behavior" title="Undefined behavior">undefined behavior</a>. </p> <div class="mw-heading mw-heading2"><h2 id="Methods_to_address_integer_overflow_problems">Methods to address integer overflow problems</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Integer_overflow&amp;action=edit&amp;section=5" title="Edit section: Methods to address integer overflow problems"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <table class="wikitable" style="float:right; margin-left:1em; margin-right:0; width:30%;"> <caption>Integer overflow handling in various programming languages </caption> <tbody><tr> <th>Language </th> <th>Unsigned integer </th> <th>Signed integer </th></tr> <tr> <td><a href="/wiki/Ada_(programming_language)" title="Ada (programming language)">Ada</a></td> <td>modulo the type's modulus</td> <td><samp><b>raise</b> Constraint_Error</samp> </td></tr> <tr> <td><a href="/wiki/C_(programming_language)" title="C (programming language)">C</a>, <a href="/wiki/C%2B%2B" title="C++">C++</a></td> <td>modulo power of two</td> <td>undefined behavior </td></tr> <tr> <td><a href="/wiki/C_Sharp_(programming_language)" title="C Sharp (programming language)">C#</a></td> <td colspan="2">modulo power of 2 in unchecked context; <code>System.OverflowException</code> is raised in checked context<sup id="cite_ref-10" class="reference"><a href="#cite_note-10"><span class="cite-bracket">&#91;</span>10<span class="cite-bracket">&#93;</span></a></sup> </td></tr> <tr> <td><a href="/wiki/Java_(programming_language)" title="Java (programming language)">Java</a></td> <td>modulo power of two (char is the only unsigned primitive type in Java)</td> <td>modulo power of two </td></tr> <tr> <td><a href="/wiki/JavaScript" title="JavaScript">JavaScript</a></td> <td colspan="2">all numbers are <a href="/wiki/Double-precision_floating-point_format" title="Double-precision floating-point format">double-precision floating-point</a> except the new <a rel="nofollow" class="external text" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt">BigInt</a> </td></tr> <tr> <td><a href="/wiki/MATLAB" title="MATLAB">MATLAB</a></td> <td colspan="2">Builtin integers saturate. Fixed-point integers configurable to wrap or saturate </td></tr> <tr> <td><a href="/wiki/Python_(programming_language)" title="Python (programming language)">Python</a> 2</td> <td data-sort-value="" style="background: var(--background-color-interactive, #ececec); color: var(--color-base, inherit); vertical-align: middle; text-align: center;" class="table-na">—</td> <td>convert to <var>long</var> type (bigint) </td></tr> <tr> <td><a href="/wiki/Seed7" title="Seed7">Seed7</a></td> <td data-sort-value="" style="background: var(--background-color-interactive, #ececec); color: var(--color-base, inherit); vertical-align: middle; text-align: center;" class="table-na">—</td> <td><samp><b>raise</b> OVERFLOW_ERROR</samp><sup id="cite_ref-11" class="reference"><a href="#cite_note-11"><span class="cite-bracket">&#91;</span>11<span class="cite-bracket">&#93;</span></a></sup> </td></tr> <tr> <td><a href="/wiki/Scheme_(programming_language)" title="Scheme (programming language)">Scheme</a></td> <td data-sort-value="" style="background: var(--background-color-interactive, #ececec); color: var(--color-base, inherit); vertical-align: middle; text-align: center;" class="table-na">—</td> <td>convert to bigNum </td></tr> <tr> <td><a href="/wiki/Simulink" title="Simulink">Simulink</a></td> <td colspan="2">configurable to wrap or saturate </td></tr> <tr> <td><a href="/wiki/Smalltalk" title="Smalltalk">Smalltalk</a></td> <td data-sort-value="" style="background: var(--background-color-interactive, #ececec); color: var(--color-base, inherit); vertical-align: middle; text-align: center;" class="table-na">—</td> <td>convert to LargeInteger </td></tr> <tr> <td><a href="/wiki/Swift_(programming_language)" title="Swift (programming language)">Swift</a></td> <td colspan="2">Causes error unless using special overflow operators.<sup id="cite_ref-12" class="reference"><a href="#cite_note-12"><span class="cite-bracket">&#91;</span>12<span class="cite-bracket">&#93;</span></a></sup> </td></tr> </tbody></table> <div class="mw-heading mw-heading3"><h3 id="Detection">Detection</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Integer_overflow&amp;action=edit&amp;section=6" title="Edit section: Detection"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Run-time overflow detection implementation <code>UBSan</code> (<a href="/wiki/Undefined_behavior" title="Undefined behavior">undefined behavior</a> sanitizer) is available for <a href="/wiki/C_compiler" class="mw-redirect" title="C compiler">C compilers</a>. </p><p>In Java 8, there are <a href="/wiki/Function_overloading" title="Function overloading">overloaded methods</a>, for example <code><a rel="nofollow" class="external text" href="https://docs.oracle.com/en/java/javase/19/docs/api/java.base/java/lang/Math.html#addExact(int,int)">Math.addExact(int, int)</a></code>, which will throw an <code><a rel="nofollow" class="external text" href="https://docs.oracle.com/en/java/javase/19/docs/api/java.base/java/lang/ArithmeticException.html">ArithmeticException</a></code> in case of overflow. </p><p><a href="/wiki/Computer_emergency_response_team" title="Computer emergency response team">Computer emergency response team</a> (CERT) developed the As-if Infinitely Ranged (AIR) integer model, a largely automated mechanism to eliminate integer overflow and truncation in C/C++ using run-time error handling.<sup id="cite_ref-13" class="reference"><a href="#cite_note-13"><span class="cite-bracket">&#91;</span>13<span class="cite-bracket">&#93;</span></a></sup> </p> <div class="mw-heading mw-heading3"><h3 id="Avoidance">Avoidance</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Integer_overflow&amp;action=edit&amp;section=7" title="Edit section: Avoidance"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>By allocating variables with data types that are large enough to contain all values that may possibly be computed and stored in them, it is always possible to avoid overflow. Even when the available space or the fixed data types provided by a programming language or environment are too limited to allow for variables to be defensively allocated with generous sizes, by carefully ordering operations and checking operands in advance, it is often possible to ensure <i>a priori</i> that the result will never be larger than can be stored. <a href="/wiki/Static_program_analysis" title="Static program analysis">Static analysis</a> tools, <a href="/wiki/Formal_verification" title="Formal verification">formal verification</a> and <a href="/wiki/Design_by_contract" title="Design by contract">design by contract</a> techniques can be used to more confidently and robustly ensure that an overflow cannot accidentally result. </p> <div class="mw-heading mw-heading3"><h3 id="Handling">Handling</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Integer_overflow&amp;action=edit&amp;section=8" title="Edit section: Handling"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>If it is anticipated that overflow may occur, then tests can be inserted into the program to detect when it happens, or is about to happen, and do other processing to mitigate it. For example, if an important result computed from user input overflows, the program can stop, reject the input, and perhaps prompt the user for different input, rather than the program proceeding with the invalid overflowed input and probably malfunctioning as a consequence. </p><p><a href="/wiki/Central_processing_unit" title="Central processing unit">CPUs</a> generally have a way to detect this to support addition of numbers larger than their register size, typically using a status bit. The technique is called multiple-precision arithmetic. Thus, it is possible to perform byte-wide addition on operands wider than a byte: first add the low bytes, store the result and check for overflow; then add the high bytes, and if necessary add the <i>carry</i> from the low bytes, then store the result. </p><p>Handling possible overflow of a calculation may sometimes present a choice between performing a check <i>before</i> a calculation (to determine whether or not overflow is going to occur), or <i>after</i> it (to consider whether or not it likely occurred based on the resulting value). Since some implementations might generate a <a href="/wiki/Interrupt" title="Interrupt">trap</a> condition on integer overflow, the most portable programs test in advance of performing the operation that might overflow. </p> <div class="mw-heading mw-heading3"><h3 id="Programming_language_support">Programming language support</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Integer_overflow&amp;action=edit&amp;section=9" title="Edit section: Programming language support"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Programming languages implement various mitigation methods against an accidental overflow: <a href="/wiki/Ada_(programming_language)" title="Ada (programming language)">Ada</a>, <a href="/wiki/Seed7" title="Seed7">Seed7</a>, and certain variants of functional languages trigger an exception condition on overflow, while <a href="/wiki/Python_(programming_language)" title="Python (programming language)">Python</a> (since 2.4) seamlessly converts internal representation of the number to match its growth, eventually representing it as <code>long</code> – whose ability is only limited by the available memory.<sup id="cite_ref-14" class="reference"><a href="#cite_note-14"><span class="cite-bracket">&#91;</span>14<span class="cite-bracket">&#93;</span></a></sup> </p><p>In languages with native support for <a href="/wiki/Arbitrary-precision_arithmetic" title="Arbitrary-precision arithmetic">arbitrary-precision arithmetic</a> and <a href="/wiki/Type_safety" title="Type safety">type safety</a> (such as <a href="/wiki/Python_(programming_language)" title="Python (programming language)">Python</a>, <a href="/wiki/Smalltalk" title="Smalltalk">Smalltalk</a>, or <a href="/wiki/Common_Lisp" title="Common Lisp">Common Lisp</a>), numbers are promoted to a larger size automatically when overflows occur, or exceptions thrown (conditions signaled) when a range constraint exists. Using such languages may thus be helpful to mitigate this issue. However, in some such languages, situations are still possible where an integer overflow can occur. An example is explicit optimization of a code path which is considered a bottleneck by the profiler. In the case of <a href="/wiki/Common_Lisp" title="Common Lisp">Common Lisp</a>, this is possible by using an explicit declaration to type-annotate a variable to a machine-size word (fixnum)<sup id="cite_ref-15" class="reference"><a href="#cite_note-15"><span class="cite-bracket">&#91;</span>15<span class="cite-bracket">&#93;</span></a></sup> and lower the type safety level to zero<sup id="cite_ref-16" class="reference"><a href="#cite_note-16"><span class="cite-bracket">&#91;</span>16<span class="cite-bracket">&#93;</span></a></sup> for a particular code block.<sup id="cite_ref-reddy_17-0" class="reference"><a href="#cite_note-reddy-17"><span class="cite-bracket">&#91;</span>17<span class="cite-bracket">&#93;</span></a></sup><sup id="cite_ref-18" class="reference"><a href="#cite_note-18"><span class="cite-bracket">&#91;</span>18<span class="cite-bracket">&#93;</span></a></sup><sup id="cite_ref-19" class="reference"><a href="#cite_note-19"><span class="cite-bracket">&#91;</span>19<span class="cite-bracket">&#93;</span></a></sup><sup id="cite_ref-20" class="reference"><a href="#cite_note-20"><span class="cite-bracket">&#91;</span>20<span class="cite-bracket">&#93;</span></a></sup> </p><p>In stark contrast to older languages such as C, some newer languages such as <a href="/wiki/Rust_(programming_language)" title="Rust (programming language)">Rust</a> provide built-in functions that allow easy detection and user choice over how overflow should be handled case-by-case. In Rust, while use of basic mathematic operators naturally lacks such flexibility, users can alternatively perform calculations via a set of methods provided by each of the integer primitive types. These methods give users several choices between performing a <i>checked</i> (or <i>overflowing</i>) operation (which indicates whether or not overflow occurred via the return type); an 'unchecked' operation; an operation that performs wrapping, or an operation which performs saturation at the numeric bounds. </p> <div class="mw-heading mw-heading3"><h3 id="Saturated_arithmetic">Saturated arithmetic</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Integer_overflow&amp;action=edit&amp;section=10" title="Edit section: Saturated arithmetic"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>In <a href="/wiki/Computer_graphics" title="Computer graphics">computer graphics</a> or <a href="/wiki/Signal_processing" title="Signal processing">signal processing</a>, it is typical to work on data that ranges from 0 to 1 or from −1 to 1. For example, take a <a href="/wiki/Grayscale" title="Grayscale">grayscale</a> image where 0 represents black, 1 represents white, and the values in between represent shades of gray. One operation that one may want to support is brightening the image by multiplying every <a href="/wiki/Pixel" title="Pixel">pixel</a> by a constant. <a href="/wiki/Saturated_arithmetic" class="mw-redirect" title="Saturated arithmetic">Saturated arithmetic</a> allows one to just blindly multiply every pixel by that constant without worrying about overflow by just sticking to a reasonable outcome that all these pixels larger than 1 (i.e., <a href="/wiki/High-dynamic-range_imaging" class="mw-redirect" title="High-dynamic-range imaging">"brighter than white"</a>) just become white and all values "darker than black" just become black. </p> <div class="mw-heading mw-heading2"><h2 id="Examples">Examples</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Integer_overflow&amp;action=edit&amp;section=11" title="Edit section: Examples"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Unanticipated arithmetic overflow is a fairly common cause of <a href="/wiki/Software_bug" title="Software bug">program errors</a>. Such overflow bugs may be hard to discover and diagnose because they may manifest themselves only for very large input data sets, which are less likely to be used in validation tests. </p><p>Taking the arithmetic mean of two numbers by adding them and dividing by two, as done in many <a href="/wiki/Search_algorithm" title="Search algorithm">search algorithms</a>, causes error if the sum (although not the resulting mean) is too large to be represented and hence overflows.<sup id="cite_ref-21" class="reference"><a href="#cite_note-21"><span class="cite-bracket">&#91;</span>21<span class="cite-bracket">&#93;</span></a></sup> </p><p>Between 1985 and 1987, arithmetic overflow in the <a href="/wiki/Therac-25" title="Therac-25">Therac-25</a> <a href="/wiki/Radiation_therapy" title="Radiation therapy">radiation therapy</a> machines, along with a lack of hardware safety controls, caused the death of at least six people from radiation overdoses.<sup id="cite_ref-22" class="reference"><a href="#cite_note-22"><span class="cite-bracket">&#91;</span>22<span class="cite-bracket">&#93;</span></a></sup> </p><p>An unhandled arithmetic overflow in the engine steering software was the primary cause of the crash of the 1996 maiden flight of the <a href="/wiki/Ariane_5_Flight_501" class="mw-redirect" title="Ariane 5 Flight 501">Ariane 5</a> rocket.<sup id="cite_ref-23" class="reference"><a href="#cite_note-23"><span class="cite-bracket">&#91;</span>23<span class="cite-bracket">&#93;</span></a></sup> The software had been considered bug-free since it had been used in many previous flights, but those used smaller rockets which generated lower acceleration than Ariane 5. Frustratingly, the part of the software in which the overflow error occurred was not even required to be running for the Ariane 5 at the time that it caused the rocket to fail: it was a launch-regime process for a smaller predecessor of the Ariane 5 that had remained in the software when it was adapted for the new rocket. Further, the true cause of the failure was a flaw in the engineering specification of how the software dealt with the overflow when it was detected: it did a diagnostic dump to its bus, which would have been connected to test equipment during software testing during development but was connected to the rocket steering motors during flight; the data dump drove the engine nozzle hard to one side which put the rocket out of aerodynamic control and precipitated its rapid breakup in the air.<sup id="cite_ref-24" class="reference"><a href="#cite_note-24"><span class="cite-bracket">&#91;</span>24<span class="cite-bracket">&#93;</span></a></sup> </p><p>On 30 April 2015, the U.S. <a href="/wiki/Federal_Aviation_Administration" title="Federal Aviation Administration">Federal Aviation Administration</a> announced it will order <a href="/wiki/Boeing_787" class="mw-redirect" title="Boeing 787">Boeing 787</a> operators to reset its electrical system periodically, to avoid an integer overflow which could lead to loss of electrical power and <a href="/wiki/Ram_air_turbine" title="Ram air turbine">ram air turbine</a> deployment, and Boeing deployed a <a href="/wiki/Software_update" class="mw-redirect" title="Software update">software update</a> in the fourth quarter.<sup id="cite_ref-25" class="reference"><a href="#cite_note-25"><span class="cite-bracket">&#91;</span>25<span class="cite-bracket">&#93;</span></a></sup> The <a href="/wiki/European_Aviation_Safety_Agency" class="mw-redirect" title="European Aviation Safety Agency">European Aviation Safety Agency</a> followed on 4 May 2015.<sup id="cite_ref-26" class="reference"><a href="#cite_note-26"><span class="cite-bracket">&#91;</span>26<span class="cite-bracket">&#93;</span></a></sup> The error happens after 2<sup>31</sup> hundredths of a second (about 249 days), indicating a 32-bit <a href="/wiki/Signed_number_representations" title="Signed number representations">signed</a> <a href="/wiki/Integer_(computer_science)" title="Integer (computer science)">integer</a>. </p><p>Overflow bugs are evident in some computer games. In <i><a href="/wiki/Super_Mario_Bros." title="Super Mario Bros.">Super Mario Bros.</a></i> for the <a href="/wiki/NES" class="mw-redirect" title="NES">NES</a>, the stored number of lives is a signed byte (ranging from −128 to 127) meaning the player can safely have 127 lives, but when the player reaches their 128th life, the counter rolls over to zero lives (although the number counter is glitched before this happens) and stops keeping count. As such, if the player then dies it's an immediate game over. This is caused by the game's data overflow that was an error of programming as the developers may not have thought said number of lives would be reasonably earned in a full playthrough. </p><p>In the arcade game <i><a href="/wiki/Donkey_Kong_(arcade_game)" class="mw-redirect" title="Donkey Kong (arcade game)">Donkey Kong</a></i>, it is impossible to advance past level 22 due to an integer overflow in its time/bonus. The game calculates the time/bonus by taking the level number a user is on, multiplying it by 10, and adding 40. When they reach level 22, the time/bonus number is 260, which is too large for its 8-bit 256 value register, so it overflows to a value of 4 – too short to finish the level. In <i><a href="/wiki/Donkey_Kong_Jr._Math" title="Donkey Kong Jr. Math">Donkey Kong Jr. Math</a></i>, when trying to calculate a number over 10,000, it shows only the first 4 digits. Overflow is the cause of the famous <a href="/wiki/Kill_screen" class="mw-redirect" title="Kill screen">"split-screen" level</a> in <i><a href="/wiki/Pac-Man" title="Pac-Man">Pac-Man</a></i>.<sup id="cite_ref-27" class="reference"><a href="#cite_note-27"><span class="cite-bracket">&#91;</span>27<span class="cite-bracket">&#93;</span></a></sup> Such a bug also caused the <i>Far Lands</i> in <i><a href="/wiki/Minecraft" title="Minecraft">Minecraft</a></i> Java Edition which existed from the Infdev development period to Beta 1.7.3; it was later fixed in Beta 1.8. The same bug also existed in <i>Minecraft</i> Bedrock Edition but has since been fixed.<sup id="cite_ref-28" class="reference"><a href="#cite_note-28"><span class="cite-bracket">&#91;</span>28<span class="cite-bracket">&#93;</span></a></sup><sup class="noprint Inline-Template" style="white-space:nowrap;">&#91;<i><a href="/wiki/Wikipedia:Reliable_sources" title="Wikipedia:Reliable sources"><span title="The material near this tag may rely on an unreliable source. (October 2024)">unreliable source?</span></a></i>&#93;</sup> </p><p> In the <a href="/wiki/Super_Nintendo_Entertainment_System" title="Super Nintendo Entertainment System">Super Nintendo Entertainment System</a> (SNES) game <a href="/wiki/Lamborghini_American_Challenge" title="Lamborghini American Challenge">Lamborghini American Challenge</a>, the player can cause their amount of money to drop below $0 during a race by being fined over the limit of remaining money after paying the fee for a race, which glitches the integer and grants the player $65,535,000 more than it would have had after going negative.<sup id="cite_ref-29" class="reference"><a href="#cite_note-29"><span class="cite-bracket">&#91;</span>29<span class="cite-bracket">&#93;</span></a></sup></p><figure class="mw-default-size" typeof="mw:File/Thumb"><a href="/wiki/File:Error_message_due_to_an_integer_signedness_bug_in_the_stack_setup_code_of_MASM_1.00.gif" class="mw-file-description"><img src="//upload.wikimedia.org/wikipedia/commons/thumb/4/4e/Error_message_due_to_an_integer_signedness_bug_in_the_stack_setup_code_of_MASM_1.00.gif/220px-Error_message_due_to_an_integer_signedness_bug_in_the_stack_setup_code_of_MASM_1.00.gif" decoding="async" width="220" height="122" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/4/4e/Error_message_due_to_an_integer_signedness_bug_in_the_stack_setup_code_of_MASM_1.00.gif/330px-Error_message_due_to_an_integer_signedness_bug_in_the_stack_setup_code_of_MASM_1.00.gif 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/4/4e/Error_message_due_to_an_integer_signedness_bug_in_the_stack_setup_code_of_MASM_1.00.gif/440px-Error_message_due_to_an_integer_signedness_bug_in_the_stack_setup_code_of_MASM_1.00.gif 2x" data-file-width="720" data-file-height="400" /></a><figcaption>An integer signedness bug in the stack setup code emitted by the <a href="/wiki/Pascal_(programming_language)" title="Pascal (programming language)">Pascal</a> compiler prevented IBM–<a href="/wiki/Microsoft_Macro_Assembler" title="Microsoft Macro Assembler">Microsoft Macro Assembler</a> (MASM) version 1.00, a <a href="/wiki/DOS" title="DOS">DOS</a> program from 1981, and many other programs compiled with the same compiler, to run under some configurations with more than 512 KB of memory.</figcaption></figure> <p>IBM–<a href="/wiki/Microsoft_Macro_Assembler" title="Microsoft Macro Assembler">Microsoft Macro Assembler</a> (MASM) version 1.00, and likely all other programs built by the same <a href="/wiki/Pascal_(programming_language)" title="Pascal (programming language)">Pascal</a> compiler, had an integer overflow and signedness error in the stack setup code, which prevented them from running on newer <a href="/wiki/DOS" title="DOS">DOS</a> machines or emulators under some common configurations with more than 512 KB of memory. The program either hangs or displays an error message and exits to DOS.<sup id="cite_ref-30" class="reference"><a href="#cite_note-30"><span class="cite-bracket">&#91;</span>30<span class="cite-bracket">&#93;</span></a></sup> </p><p>In August 2016, a <a href="/wiki/Casino" title="Casino">casino</a> machine at <a href="/wiki/Resorts_World" title="Resorts World">Resorts World</a> casino printed a prize ticket of $42,949,672.76 as a result of an overflow bug. The casino refused to pay this amount, calling it a malfunction, using in their defense that the machine clearly stated that the maximum payout was $10,000, so any prize exceeding that had to be the result of a programming bug. The <a href="/wiki/New_York_State_Gaming_Commission" title="New York State Gaming Commission">New York State Gaming Commission</a> ruled in favor of the casino.<sup id="cite_ref-31" class="reference"><a href="#cite_note-31"><span class="cite-bracket">&#91;</span>31<span class="cite-bracket">&#93;</span></a></sup> </p> <div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Integer_overflow&amp;action=edit&amp;section=12" title="Edit section: See also"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <ul><li><a href="/wiki/Carry_(arithmetic)" title="Carry (arithmetic)">Carry (arithmetic)</a></li> <li><a href="/wiki/Modular_arithmetic" title="Modular arithmetic">Modular arithmetic</a></li> <li><a href="/wiki/Nuclear_Gandhi" title="Nuclear Gandhi">Nuclear Gandhi</a></li></ul> <div class="mw-heading mw-heading2"><h2 id="References">References</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Integer_overflow&amp;action=edit&amp;section=13" title="Edit section: References"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <style data-mw-deduplicate="TemplateStyles:r1239543626">.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}</style><div class="reflist"> <div class="mw-references-wrap mw-references-columns"><ol class="references"> <li id="cite_note-auto-1"><span class="mw-cite-backlink">^ <a href="#cite_ref-auto_1-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-auto_1-1"><sup><i><b>b</b></i></sup></a> <a href="#cite_ref-auto_1-2"><sup><i><b>c</b></i></sup></a></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1238218222">.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("//upload.wikimedia.org/wikipedia/commons/6/65/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("//upload.wikimedia.org/wikipedia/commons/d/d6/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("//upload.wikimedia.org/wikipedia/commons/a/aa/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("//upload.wikimedia.org/wikipedia/commons/4/4c/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}</style><cite id="CITEREFISO_staff" class="citation web cs1">ISO staff. <a rel="nofollow" class="external text" href="https://webstore.ansi.org/RecordDetail.aspx?sku=ISO/IEC+9899:2011">"ISO/IEC 9899:2011 Information technology - Programming languages - C"</a>. <i>ANSI.org</i>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=unknown&amp;rft.jtitle=ANSI.org&amp;rft.atitle=ISO%2FIEC+9899%3A2011+Information+technology+-+Programming+languages+-+C&amp;rft.au=ISO+staff&amp;rft_id=https%3A%2F%2Fwebstore.ansi.org%2FRecordDetail.aspx%3Fsku%3DISO%2FIEC%2B9899%3A2011&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AInteger+overflow" class="Z3988"></span></span> </li> <li id="cite_note-2"><span class="mw-cite-backlink"><b><a href="#cite_ref-2">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://www.mathworks.com/help/simulink/gui/wrap-on-overflow.html?searchHighlight=overflow&amp;s_tid=doc_srchtitle">"Wrap on overflow - MATLAB &amp; Simulink"</a>. <i>www.mathworks.com</i>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=unknown&amp;rft.jtitle=www.mathworks.com&amp;rft.atitle=Wrap+on+overflow+-+MATLAB+%26+Simulink&amp;rft_id=https%3A%2F%2Fwww.mathworks.com%2Fhelp%2Fsimulink%2Fgui%2Fwrap-on-overflow.html%3FsearchHighlight%3Doverflow%26s_tid%3Ddoc_srchtitle&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AInteger+overflow" class="Z3988"></span></span> </li> <li id="cite_note-3"><span class="mw-cite-backlink"><b><a href="#cite_ref-3">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://www.mathworks.com/help/simulink/gui/saturate-on-overflow.html?searchHighlight=overflow&amp;s_tid=doc_srchtitle">"Saturate on overflow - MATLAB &amp; Simulink"</a>. <i>www.mathworks.com</i>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=unknown&amp;rft.jtitle=www.mathworks.com&amp;rft.atitle=Saturate+on+overflow+-+MATLAB+%26+Simulink&amp;rft_id=https%3A%2F%2Fwww.mathworks.com%2Fhelp%2Fsimulink%2Fgui%2Fsaturate-on-overflow.html%3FsearchHighlight%3Doverflow%26s_tid%3Ddoc_srchtitle&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AInteger+overflow" class="Z3988"></span></span> </li> <li id="cite_note-4"><span class="mw-cite-backlink"><b><a href="#cite_ref-4">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://cwe.mitre.org/data/definitions/191.html">"CWE - CWE-191: Integer Underflow (Wrap or Wraparound) (3.1)"</a>. <i>cwe.mitre.org</i>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=unknown&amp;rft.jtitle=cwe.mitre.org&amp;rft.atitle=CWE+-+CWE-191%3A+Integer+Underflow+%28Wrap+or+Wraparound%29+%283.1%29&amp;rft_id=https%3A%2F%2Fcwe.mitre.org%2Fdata%2Fdefinitions%2F191.html&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AInteger+overflow" class="Z3988"></span></span> </li> <li id="cite_note-5"><span class="mw-cite-backlink"><b><a href="#cite_ref-5">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://dzone.com/articles/overflow-and-underflow-data">"Overflow And Underflow of Data Types in Java - DZone Java"</a>. <i>dzone.com</i>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=unknown&amp;rft.jtitle=dzone.com&amp;rft.atitle=Overflow+And+Underflow+of+Data+Types+in+Java+-+DZone+Java&amp;rft_id=https%3A%2F%2Fdzone.com%2Farticles%2Foverflow-and-underflow-data&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AInteger+overflow" class="Z3988"></span></span> </li> <li id="cite_note-6"><span class="mw-cite-backlink"><b><a href="#cite_ref-6">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFMir2017" class="citation web cs1">Mir, Tabish (4 April 2017). <a rel="nofollow" class="external text" href="https://medium.com/@taabishm2/integer-overflow-underflow-and-floating-point-imprecision-6ba869a99033">"Integer Overflow/Underflow and Floating Point Imprecision"</a>. <i>medium.com</i>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=unknown&amp;rft.jtitle=medium.com&amp;rft.atitle=Integer+Overflow%2FUnderflow+and+Floating+Point+Imprecision&amp;rft.date=2017-04-04&amp;rft.aulast=Mir&amp;rft.aufirst=Tabish&amp;rft_id=https%3A%2F%2Fmedium.com%2F%40taabishm2%2Finteger-overflow-underflow-and-floating-point-imprecision-6ba869a99033&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AInteger+overflow" class="Z3988"></span></span> </li> <li id="cite_note-7"><span class="mw-cite-backlink"><b><a href="#cite_ref-7">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://www.mozilla.org/en-US/security/advisories/mfsa2015-147/">"Integer underflow and buffer overflow processing MP4 metadata in libstagefright"</a>. <i>Mozilla</i>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=unknown&amp;rft.jtitle=Mozilla&amp;rft.atitle=Integer+underflow+and+buffer+overflow+processing+MP4+metadata+in+libstagefright&amp;rft_id=https%3A%2F%2Fwww.mozilla.org%2Fen-US%2Fsecurity%2Fadvisories%2Fmfsa2015-147%2F&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AInteger+overflow" class="Z3988"></span></span> </li> <li id="cite_note-8"><span class="mw-cite-backlink"><b><a href="#cite_ref-8">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://developer.apple.com/library/content/documentation/Security/Conceptual/SecureCodingGuide/Articles/BufferOverflows.html#//apple_ref/doc/uid/TP40002577-SW7">"Avoiding Buffer Overflows and Underflows"</a>. <i>developer.apple.com</i>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=unknown&amp;rft.jtitle=developer.apple.com&amp;rft.atitle=Avoiding+Buffer+Overflows+and+Underflows&amp;rft_id=https%3A%2F%2Fdeveloper.apple.com%2Flibrary%2Fcontent%2Fdocumentation%2FSecurity%2FConceptual%2FSecureCodingGuide%2FArticles%2FBufferOverflows.html%23%2F%2Fapple_ref%2Fdoc%2Fuid%2FTP40002577-SW7&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AInteger+overflow" class="Z3988"></span></span> </li> <li id="cite_note-9"><span class="mw-cite-backlink"><b><a href="#cite_ref-9">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://doc.rust-lang.org/stable/reference/expressions/operator-expr.html#overflow">"Operator expressions - The Rust Reference"</a>. <i>Rust-lang.org</i><span class="reference-accessdate">. Retrieved <span class="nowrap">2021-02-12</span></span>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=unknown&amp;rft.jtitle=Rust-lang.org&amp;rft.atitle=Operator+expressions+-+The+Rust+Reference&amp;rft_id=https%3A%2F%2Fdoc.rust-lang.org%2Fstable%2Freference%2Fexpressions%2Foperator-expr.html%23overflow&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AInteger+overflow" class="Z3988"></span></span> </li> <li id="cite_note-10"><span class="mw-cite-backlink"><b><a href="#cite_ref-10">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFBillWagner2023" class="citation web cs1">BillWagner (8 April 2023). <a rel="nofollow" class="external text" href="http://msdn.microsoft.com/en-us/library/khy08726.aspx">"Checked and Unchecked (C# Reference)"</a>. <i>msdn.microsoft.com</i>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=unknown&amp;rft.jtitle=msdn.microsoft.com&amp;rft.atitle=Checked+and+Unchecked+%28C%23+Reference%29&amp;rft.date=2023-04-08&amp;rft.au=BillWagner&amp;rft_id=http%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2Fkhy08726.aspx&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AInteger+overflow" class="Z3988"></span></span> </li> <li id="cite_note-11"><span class="mw-cite-backlink"><b><a href="#cite_ref-11">^</a></b></span> <span class="reference-text"><a rel="nofollow" class="external text" href="http://seed7.sourceforge.net/manual/errors.htm#OVERFLOW_ERROR">Seed7 manual</a>, section 16.3.3 OVERFLOW_ERROR.</span> </li> <li id="cite_note-12"><span class="mw-cite-backlink"><b><a href="#cite_ref-12">^</a></b></span> <span class="reference-text">The Swift Programming Language. Swift 2.1 Edition. October 21, 2015.</span> </li> <li id="cite_note-13"><span class="mw-cite-backlink"><b><a href="#cite_ref-13">^</a></b></span> <span class="reference-text"><a rel="nofollow" class="external text" href="http://www.cert.org/archive/pdf/09tn023.pdf">As-if Infinitely Ranged Integer Model</a></span> </li> <li id="cite_note-14"><span class="mw-cite-backlink"><b><a href="#cite_ref-14">^</a></b></span> <span class="reference-text"><a rel="nofollow" class="external text" href="https://docs.python.org/2/reference/expressions.html">Python documentation</a>, section 5.1 Arithmetic conversions.</span> </li> <li id="cite_note-15"><span class="mw-cite-backlink"><b><a href="#cite_ref-15">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://www.lispworks.com/documentation/HyperSpec/Body/d_type.htm">"<i>Declaration</i> <b>TYPE</b>"</a>. <i>Common Lisp HyperSpec</i>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=unknown&amp;rft.jtitle=Common+Lisp+HyperSpec&amp;rft.atitle=Declaration+TYPE&amp;rft_id=http%3A%2F%2Fwww.lispworks.com%2Fdocumentation%2FHyperSpec%2FBody%2Fd_type.htm&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AInteger+overflow" class="Z3988"></span></span> </li> <li id="cite_note-16"><span class="mw-cite-backlink"><b><a href="#cite_ref-16">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://www.lispworks.com/documentation/HyperSpec/Body/d_optimi.htm">"<i>Declaration</i> <b>OPTIMIZE</b>"</a>. <i>Common Lisp HyperSpec</i>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=unknown&amp;rft.jtitle=Common+Lisp+HyperSpec&amp;rft.atitle=Declaration+OPTIMIZE&amp;rft_id=http%3A%2F%2Fwww.lispworks.com%2Fdocumentation%2FHyperSpec%2FBody%2Fd_optimi.htm&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AInteger+overflow" class="Z3988"></span></span> </li> <li id="cite_note-reddy-17"><span class="mw-cite-backlink"><b><a href="#cite_ref-reddy_17-0">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFReddy2008" class="citation web cs1">Reddy, Abhishek (2008-08-22). <a rel="nofollow" class="external text" href="http://random-state.net/features-of-common-lisp.html">"Features of Common Lisp"</a>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=unknown&amp;rft.btitle=Features+of+Common+Lisp&amp;rft.date=2008-08-22&amp;rft.aulast=Reddy&amp;rft.aufirst=Abhishek&amp;rft_id=http%3A%2F%2Frandom-state.net%2Ffeatures-of-common-lisp.html&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AInteger+overflow" class="Z3988"></span></span> </li> <li id="cite_note-18"><span class="mw-cite-backlink"><b><a href="#cite_ref-18">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFPierce2002" class="citation book cs1"><a href="/wiki/Benjamin_C._Pierce" title="Benjamin C. Pierce">Pierce, Benjamin C.</a> (2002). <a rel="nofollow" class="external text" href="http://www.cis.upenn.edu/~bcpierce/tapl/"><i>Types and Programming Languages</i></a>. MIT Press. <a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a>&#160;<a href="/wiki/Special:BookSources/0-262-16209-1" title="Special:BookSources/0-262-16209-1"><bdi>0-262-16209-1</bdi></a>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=book&amp;rft.btitle=Types+and+Programming+Languages&amp;rft.pub=MIT+Press&amp;rft.date=2002&amp;rft.isbn=0-262-16209-1&amp;rft.aulast=Pierce&amp;rft.aufirst=Benjamin+C.&amp;rft_id=http%3A%2F%2Fwww.cis.upenn.edu%2F~bcpierce%2Ftapl%2F&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AInteger+overflow" class="Z3988"></span></span> </li> <li id="cite_note-19"><span class="mw-cite-backlink"><b><a href="#cite_ref-19">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFWrightFelleisen1994" class="citation journal cs1">Wright, Andrew K.; <a href="/wiki/Matthias_Felleisen" title="Matthias Felleisen">Felleisen, Matthias</a> (1994). <a rel="nofollow" class="external text" href="http://citeseer.ist.psu.edu/wright92syntactic.html">"A Syntactic Approach to Type Soundness"</a>. <i>Information and Computation</i>. <b>115</b> (1): 38–94. <a href="/wiki/Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<span class="id-lock-free" title="Freely accessible"><a rel="nofollow" class="external text" href="https://doi.org/10.1006%2Finco.1994.1093">10.1006/inco.1994.1093</a></span>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=article&amp;rft.jtitle=Information+and+Computation&amp;rft.atitle=A+Syntactic+Approach+to+Type+Soundness&amp;rft.volume=115&amp;rft.issue=1&amp;rft.pages=38-94&amp;rft.date=1994&amp;rft_id=info%3Adoi%2F10.1006%2Finco.1994.1093&amp;rft.aulast=Wright&amp;rft.aufirst=Andrew+K.&amp;rft.au=Felleisen%2C+Matthias&amp;rft_id=http%3A%2F%2Fciteseer.ist.psu.edu%2Fwright92syntactic.html&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AInteger+overflow" class="Z3988"></span></span> </li> <li id="cite_note-20"><span class="mw-cite-backlink"><b><a href="#cite_ref-20">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFMacrakis1982" class="citation journal cs1">Macrakis, Stavros (April 1982). "Safety and power". <i>ACM SIGSOFT Software Engineering Notes</i>. <b>7</b> (2): 25–26. <a href="/wiki/Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<a rel="nofollow" class="external text" href="https://doi.org/10.1145%2F1005937.1005941">10.1145/1005937.1005941</a>. <a href="/wiki/S2CID_(identifier)" class="mw-redirect" title="S2CID (identifier)">S2CID</a>&#160;<a rel="nofollow" class="external text" href="https://api.semanticscholar.org/CorpusID:10426644">10426644</a>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=article&amp;rft.jtitle=ACM+SIGSOFT+Software+Engineering+Notes&amp;rft.atitle=Safety+and+power&amp;rft.volume=7&amp;rft.issue=2&amp;rft.pages=25-26&amp;rft.date=1982-04&amp;rft_id=info%3Adoi%2F10.1145%2F1005937.1005941&amp;rft_id=https%3A%2F%2Fapi.semanticscholar.org%2FCorpusID%3A10426644%23id-name%3DS2CID&amp;rft.aulast=Macrakis&amp;rft.aufirst=Stavros&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AInteger+overflow" class="Z3988"></span></span> </li> <li id="cite_note-21"><span class="mw-cite-backlink"><b><a href="#cite_ref-21">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://googleresearch.blogspot.co.uk/2006/06/extra-extra-read-all-about-it-nearly.html">"Extra, Extra - Read All About It: Nearly All Binary Searches and Mergesorts are Broken"</a>. <i>googleresearch.blogspot.co.uk</i>. 2 June 2006.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=unknown&amp;rft.jtitle=googleresearch.blogspot.co.uk&amp;rft.atitle=Extra%2C+Extra+-+Read+All+About+It%3A+Nearly+All+Binary+Searches+and+Mergesorts+are+Broken&amp;rft.date=2006-06-02&amp;rft_id=http%3A%2F%2Fgoogleresearch.blogspot.co.uk%2F2006%2F06%2Fextra-extra-read-all-about-it-nearly.html&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AInteger+overflow" class="Z3988"></span></span> </li> <li id="cite_note-22"><span class="mw-cite-backlink"><b><a href="#cite_ref-22">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFBeuhler2021" class="citation web cs1">Beuhler, Patrick (2021-07-05). <a rel="nofollow" class="external text" href="https://blog.grio.com/2021/07/when-small-software-bugs-cause-big-problems.html">"When Small Software Bugs Cause Big Problems"</a>. <i>Grio Blog</i><span class="reference-accessdate">. Retrieved <span class="nowrap">2023-07-16</span></span>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=unknown&amp;rft.jtitle=Grio+Blog&amp;rft.atitle=When+Small+Software+Bugs+Cause+Big+Problems&amp;rft.date=2021-07-05&amp;rft.aulast=Beuhler&amp;rft.aufirst=Patrick&amp;rft_id=https%3A%2F%2Fblog.grio.com%2F2021%2F07%2Fwhen-small-software-bugs-cause-big-problems.html&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AInteger+overflow" class="Z3988"></span></span> </li> <li id="cite_note-23"><span class="mw-cite-backlink"><b><a href="#cite_ref-23">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFGleick1996" class="citation web cs1"><a href="/wiki/James_Gleick" title="James Gleick">Gleick, James</a> (1 December 1996). <a rel="nofollow" class="external text" href="https://www.nytimes.com/1996/12/01/magazine/little-bug-big-bang.html">"A Bug and A Crash"</a>. <i>The New York Times</i><span class="reference-accessdate">. Retrieved <span class="nowrap">17 January</span> 2019</span>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=unknown&amp;rft.jtitle=The+New+York+Times&amp;rft.atitle=A+Bug+and+A+Crash&amp;rft.date=1996-12-01&amp;rft.aulast=Gleick&amp;rft.aufirst=James&amp;rft_id=https%3A%2F%2Fwww.nytimes.com%2F1996%2F12%2F01%2Fmagazine%2Flittle-bug-big-bang.html&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AInteger+overflow" class="Z3988"></span></span> </li> <li id="cite_note-24"><span class="mw-cite-backlink"><b><a href="#cite_ref-24">^</a></b></span> <span class="reference-text">Official report of Ariane 5 launch failure incident.</span> </li> <li id="cite_note-25"><span class="mw-cite-backlink"><b><a href="#cite_ref-25">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFMouawad2015" class="citation news cs1">Mouawad, Jad (30 April 2015). <a rel="nofollow" class="external text" href="https://www.nytimes.com/2015/05/01/business/faa-orders-fix-for-possible-power-loss-in-boeing-787.html?_r=0">"F.A.A. Orders Fix for Possible Power Loss in Boeing 787"</a>. <i><a href="/wiki/New_York_Times" class="mw-redirect" title="New York Times">New York Times</a></i>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=article&amp;rft.jtitle=New+York+Times&amp;rft.atitle=F.A.A.+Orders+Fix+for+Possible+Power+Loss+in+Boeing+787&amp;rft.date=2015-04-30&amp;rft.aulast=Mouawad&amp;rft.aufirst=Jad&amp;rft_id=https%3A%2F%2Fwww.nytimes.com%2F2015%2F05%2F01%2Fbusiness%2Ffaa-orders-fix-for-possible-power-loss-in-boeing-787.html%3F_r%3D0&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AInteger+overflow" class="Z3988"></span></span> </li> <li id="cite_note-26"><span class="mw-cite-backlink"><b><a href="#cite_ref-26">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://ad.easa.europa.eu/ad/US-2015-09-07">"US-2015-09-07: Electrical Power – Deactivation"</a>. <i>Airworthiness Directives</i>. <a href="/wiki/European_Aviation_Safety_Agency" class="mw-redirect" title="European Aviation Safety Agency">European Aviation Safety Agency</a>. 4 May 2015.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=unknown&amp;rft.jtitle=Airworthiness+Directives&amp;rft.atitle=US-2015-09-07%3A+Electrical+Power+%E2%80%93+Deactivation&amp;rft.date=2015-05-04&amp;rft_id=http%3A%2F%2Fad.easa.europa.eu%2Fad%2FUS-2015-09-07&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AInteger+overflow" class="Z3988"></span></span> </li> <li id="cite_note-27"><span class="mw-cite-backlink"><b><a href="#cite_ref-27">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFPittman" class="citation web cs1">Pittman, Jamey. <a rel="nofollow" class="external text" href="http://home.comcast.net/~jpittman2/pacman/pacmandossier.html">"The Pac-Man Dossier"</a>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=unknown&amp;rft.btitle=The+Pac-Man+Dossier&amp;rft.aulast=Pittman&amp;rft.aufirst=Jamey&amp;rft_id=http%3A%2F%2Fhome.comcast.net%2F~jpittman2%2Fpacman%2Fpacmandossier.html&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AInteger+overflow" class="Z3988"></span></span> </li> <li id="cite_note-28"><span class="mw-cite-backlink"><b><a href="#cite_ref-28">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://minecraft.wiki/w/Far_Lands">"Far Lands"</a>. <i>Minecraft Wiki</i><span class="reference-accessdate">. Retrieved <span class="nowrap">24 September</span> 2023</span>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=unknown&amp;rft.jtitle=Minecraft+Wiki&amp;rft.atitle=Far+Lands&amp;rft_id=https%3A%2F%2Fminecraft.wiki%2Fw%2FFar_Lands&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AInteger+overflow" class="Z3988"></span></span> </li> <li id="cite_note-29"><span class="mw-cite-backlink"><b><a href="#cite_ref-29">^</a></b></span> <span class="reference-text">Archived at <a rel="nofollow" class="external text" href="https://ghostarchive.org/varchive/youtube/20211205/aNQdQPi0xMo">Ghostarchive</a> and the <a rel="nofollow" class="external text" href="https://web.archive.org/web/20190726012137/https://www.youtube.com/watch?v=aNQdQPi0xMo&amp;t=17m55s">Wayback Machine</a>: <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://www.youtube.com/watch?v=aNQdQPi0xMo&amp;t=17m55s">"Lamborghini American Challenge SPEEDRUN (13:24)"</a>. <i><a href="/wiki/YouTube" title="YouTube">YouTube</a></i>. 14 March 2019.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=unknown&amp;rft.jtitle=YouTube&amp;rft.atitle=Lamborghini+American+Challenge+SPEEDRUN+%2813%3A24%29&amp;rft.date=2019-03-14&amp;rft_id=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DaNQdQPi0xMo%26t%3D17m55s&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AInteger+overflow" class="Z3988"></span></span> </li> <li id="cite_note-30"><span class="mw-cite-backlink"><b><a href="#cite_ref-30">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFLenclud2017" class="citation web cs1">Lenclud, Christophe (21 April 2017). <a rel="nofollow" class="external text" href="https://slions.net/threads/debugging-the-ibm-personal-computer-macro-assembler-masm-version-1-00.33/">"Debugging IBM MACRO Assembler Version 1.00"</a>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=unknown&amp;rft.btitle=Debugging+IBM+MACRO+Assembler+Version+1.00&amp;rft.date=2017-04-21&amp;rft.aulast=Lenclud&amp;rft.aufirst=Christophe&amp;rft_id=https%3A%2F%2Fslions.net%2Fthreads%2Fdebugging-the-ibm-personal-computer-macro-assembler-masm-version-1-00.33%2F&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AInteger+overflow" class="Z3988"></span></span> </li> <li id="cite_note-31"><span class="mw-cite-backlink"><b><a href="#cite_ref-31">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFKravets2017" class="citation web cs1">Kravets, David (June 15, 2017). <a rel="nofollow" class="external text" href="https://arstechnica.com/tech-policy/2017/06/sorry-maam-you-didnt-win-43m-there-was-a-slot-machine-malfunction">"Sorry ma'am you didn't win $43M – there was a slot machine 'malfunction'<span class="cs1-kern-right"></span>"</a>. <i>Ars Technica</i>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=unknown&amp;rft.jtitle=Ars+Technica&amp;rft.atitle=Sorry+ma%27am+you+didn%27t+win+%2443M+%E2%80%93+there+was+a+slot+machine+%27malfunction%27&amp;rft.date=2017-06-15&amp;rft.aulast=Kravets&amp;rft.aufirst=David&amp;rft_id=https%3A%2F%2Farstechnica.com%2Ftech-policy%2F2017%2F06%2Fsorry-maam-you-didnt-win-43m-there-was-a-slot-machine-malfunction&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AInteger+overflow" class="Z3988"></span></span> </li> </ol></div></div> <div class="mw-heading mw-heading2"><h2 id="External_links">External links</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Integer_overflow&amp;action=edit&amp;section=14" title="Edit section: External links"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <ul><li><a rel="nofollow" class="external text" href="http://www.phrack.org/issues.html?issue=60&amp;id=10#article">Phrack #60, Basic Integer Overflows</a></li> <li><a rel="nofollow" class="external text" href="http://www.phrack.org/issues.html?issue=60&amp;id=9#article">Phrack #60, Big Loop Integer Protection</a></li> <li><a rel="nofollow" class="external text" href="https://web.archive.org/web/20121010025025/http://www.cs.cmu.edu/~dbrumley/pubs/integer-ndss-07.pdf">Efficient and Accurate Detection of Integer-based Attacks</a></li> <li><a rel="nofollow" class="external text" href="http://projects.webappsec.org/Integer-Overflows">WASC Threat Classification – Integer Overflows</a></li> <li><a rel="nofollow" class="external text" href="http://www.cs.utah.edu/~regehr/papers/tosem15.pdf">Understanding Integer Overflow in C/C++</a></li> <li><a rel="nofollow" class="external text" href="https://www.allaboutcircuits.com/textbook/digital/chpt-2/binary-overflow/">Binary Overflow – Binary Arithmetic</a></li> <li><a rel="nofollow" class="external text" href="https://webstore.ansi.org/RecordDetail.aspx?sku=ISO%2FIEC%209899:2011">ISO C11 Standard</a></li></ul> <!-- NewPP limit report Parsed by mw‐web.codfw.main‐f69cdc8f6‐c8xbz Cached time: 20241122142552 Cache expiry: 2592000 Reduced expiry: false Complications: [vary‐revision‐sha1, show‐toc] CPU time usage: 0.370 seconds Real time usage: 0.472 seconds Preprocessor visited node count: 2132/1000000 Post‐expand include size: 44793/2097152 bytes Template argument size: 2377/2097152 bytes Highest expansion depth: 15/100 Expensive parser function count: 5/500 Unstrip recursion depth: 1/20 Unstrip post‐expand size: 88603/5000000 bytes Lua time usage: 0.195/10.000 seconds Lua memory usage: 5904116/52428800 bytes Number of Wikibase entities loaded: 0/400 --> <!-- Transclusion expansion time report (%,ms,calls,template) 100.00% 403.638 1 -total 56.19% 226.806 1 Template:Reflist 39.48% 159.338 22 Template:Cite_web 17.25% 69.641 1 Template:Short_description 10.31% 41.634 2 Template:Pagetype 8.99% 36.284 1 Template:Unreliable_source 8.01% 32.320 1 Template:Fix 5.97% 24.101 2 Template:Cite_journal 5.37% 21.665 1 Template:Category_handler 4.28% 17.260 6 Template:Main_other --> <!-- Saved in parser cache with key enwiki:pcache:idhash:2151421-0!canonical and timestamp 20241122142552 and revision id 1251625021. Rendering was triggered because: page-view --> </div><!--esi <esi:include src="/esitest-fa8a495983347898/content" /> --><noscript><img src="https://login.wikimedia.org/wiki/Special:CentralAutoLogin/start?type=1x1" alt="" width="1" height="1" style="border: none; position: absolute;"></noscript> <div class="printfooter" data-nosnippet="">Retrieved from "<a dir="ltr" href="https://en.wikipedia.org/w/index.php?title=Integer_overflow&amp;oldid=1251625021">https://en.wikipedia.org/w/index.php?title=Integer_overflow&amp;oldid=1251625021</a>"</div></div> <div id="catlinks" class="catlinks" data-mw="interface"><div id="mw-normal-catlinks" class="mw-normal-catlinks"><a href="/wiki/Help:Category" title="Help:Category">Categories</a>: <ul><li><a href="/wiki/Category:Software_bugs" title="Category:Software bugs">Software bugs</a></li><li><a href="/wiki/Category:Computer_security_exploits" title="Category:Computer security exploits">Computer security exploits</a></li><li><a href="/wiki/Category:Computer_arithmetic" title="Category:Computer arithmetic">Computer arithmetic</a></li></ul></div><div id="mw-hidden-catlinks" class="mw-hidden-catlinks mw-hidden-cats-hidden">Hidden categories: <ul><li><a href="/wiki/Category:Articles_with_short_description" title="Category:Articles with short description">Articles with short description</a></li><li><a href="/wiki/Category:Short_description_is_different_from_Wikidata" title="Category:Short description is different from Wikidata">Short description is different from Wikidata</a></li><li><a href="/wiki/Category:Use_American_English_from_January_2019" title="Category:Use American English from January 2019">Use American English from January 2019</a></li><li><a href="/wiki/Category:All_Wikipedia_articles_written_in_American_English" title="Category:All Wikipedia articles written in American English">All Wikipedia articles written in American English</a></li><li><a href="/wiki/Category:Articles_containing_potentially_dated_statements_from_2005" title="Category:Articles containing potentially dated statements from 2005">Articles containing potentially dated statements from 2005</a></li><li><a href="/wiki/Category:All_articles_containing_potentially_dated_statements" title="Category:All articles containing potentially dated statements">All articles containing potentially dated statements</a></li><li><a href="/wiki/Category:Articles_containing_potentially_dated_statements_from_2024" title="Category:Articles containing potentially dated statements from 2024">Articles containing potentially dated statements from 2024</a></li><li><a href="/wiki/Category:All_articles_lacking_reliable_references" title="Category:All articles lacking reliable references">All articles lacking reliable references</a></li><li><a href="/wiki/Category:Articles_lacking_reliable_references_from_October_2024" title="Category:Articles lacking reliable references from October 2024">Articles lacking reliable references from October 2024</a></li></ul></div></div> </div> </main> </div> <div class="mw-footer-container"> <footer id="footer" class="mw-footer" > <ul id="footer-info"> <li id="footer-info-lastmod"> This page was last edited on 17 October 2024, at 03:14<span class="anonymous-show">&#160;(UTC)</span>.</li> <li id="footer-info-copyright">Text is available under the <a href="/wiki/Wikipedia:Text_of_the_Creative_Commons_Attribution-ShareAlike_4.0_International_License" title="Wikipedia:Text of the Creative Commons Attribution-ShareAlike 4.0 International License">Creative Commons Attribution-ShareAlike 4.0 License</a>; additional terms may apply. By using this site, you agree to the <a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Terms_of_Use" class="extiw" title="foundation:Special:MyLanguage/Policy:Terms of Use">Terms of Use</a> and <a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy" class="extiw" title="foundation:Special:MyLanguage/Policy:Privacy policy">Privacy Policy</a>. Wikipedia® is a registered trademark of the <a rel="nofollow" class="external text" href="https://wikimediafoundation.org/">Wikimedia Foundation, Inc.</a>, a non-profit organization.</li> </ul> <ul id="footer-places"> <li id="footer-places-privacy"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy">Privacy policy</a></li> <li id="footer-places-about"><a href="/wiki/Wikipedia:About">About Wikipedia</a></li> <li id="footer-places-disclaimers"><a href="/wiki/Wikipedia:General_disclaimer">Disclaimers</a></li> <li id="footer-places-contact"><a href="//en.wikipedia.org/wiki/Wikipedia:Contact_us">Contact Wikipedia</a></li> <li id="footer-places-wm-codeofconduct"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Universal_Code_of_Conduct">Code of Conduct</a></li> <li id="footer-places-developers"><a href="https://developer.wikimedia.org">Developers</a></li> <li id="footer-places-statslink"><a href="https://stats.wikimedia.org/#/en.wikipedia.org">Statistics</a></li> <li id="footer-places-cookiestatement"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Cookie_statement">Cookie statement</a></li> <li id="footer-places-mobileview"><a href="//en.m.wikipedia.org/w/index.php?title=Integer_overflow&amp;mobileaction=toggle_view_mobile" class="noprint stopMobileRedirectToggle">Mobile view</a></li> </ul> <ul id="footer-icons" class="noprint"> <li id="footer-copyrightico"><a href="https://wikimediafoundation.org/" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><img src="/static/images/footer/wikimedia-button.svg" width="84" height="29" alt="Wikimedia Foundation" loading="lazy"></a></li> <li id="footer-poweredbyico"><a href="https://www.mediawiki.org/" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><img src="/w/resources/assets/poweredby_mediawiki.svg" alt="Powered by MediaWiki" width="88" height="31" loading="lazy"></a></li> </ul> </footer> </div> </div> </div> <div class="vector-settings" id="p-dock-bottom"> <ul></ul> </div><script>(RLQ=window.RLQ||[]).push(function(){mw.config.set({"wgHostname":"mw-web.codfw.main-f69cdc8f6-mzm7s","wgBackendResponseTime":183,"wgPageParseReport":{"limitreport":{"cputime":"0.370","walltime":"0.472","ppvisitednodes":{"value":2132,"limit":1000000},"postexpandincludesize":{"value":44793,"limit":2097152},"templateargumentsize":{"value":2377,"limit":2097152},"expansiondepth":{"value":15,"limit":100},"expensivefunctioncount":{"value":5,"limit":500},"unstrip-depth":{"value":1,"limit":20},"unstrip-size":{"value":88603,"limit":5000000},"entityaccesscount":{"value":0,"limit":400},"timingprofile":["100.00% 403.638 1 -total"," 56.19% 226.806 1 Template:Reflist"," 39.48% 159.338 22 Template:Cite_web"," 17.25% 69.641 1 Template:Short_description"," 10.31% 41.634 2 Template:Pagetype"," 8.99% 36.284 1 Template:Unreliable_source"," 8.01% 32.320 1 Template:Fix"," 5.97% 24.101 2 Template:Cite_journal"," 5.37% 21.665 1 Template:Category_handler"," 4.28% 17.260 6 Template:Main_other"]},"scribunto":{"limitreport-timeusage":{"value":"0.195","limit":"10.000"},"limitreport-memusage":{"value":5904116,"limit":52428800}},"cachereport":{"origin":"mw-web.codfw.main-f69cdc8f6-c8xbz","timestamp":"20241122142552","ttl":2592000,"transientcontent":false}}});});</script> <script type="application/ld+json">{"@context":"https:\/\/schema.org","@type":"Article","name":"Integer overflow","url":"https:\/\/en.wikipedia.org\/wiki\/Integer_overflow","sameAs":"http:\/\/www.wikidata.org\/entity\/Q1423448","mainEntity":"http:\/\/www.wikidata.org\/entity\/Q1423448","author":{"@type":"Organization","name":"Contributors to Wikimedia projects"},"publisher":{"@type":"Organization","name":"Wikimedia Foundation, Inc.","logo":{"@type":"ImageObject","url":"https:\/\/www.wikimedia.org\/static\/images\/wmf-hor-googpub.png"}},"datePublished":"2005-07-01T18:42:53Z","dateModified":"2024-10-17T03:14:19Z","image":"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/5\/53\/Odometer_rollover.jpg","headline":"in programming, a condition that occurs when an arithmetic operation attempts to create a numeric value that is outside of the range that can be represented with a given number of digits"}</script> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10