Difference between revisions of "Signed to unsigned conversion error"

Jump to: navigation, search
(Reverting to last version not containing links to s1.shard.jp)
Line 1: Line 1:
[http://s1.shard.jp/galeach/new77.html optic nerve hypoplasia. ] [http://s1.shard.jp/galeach/new98.html asia dont cry ] [http://s1.shard.jp/frhorton/rykfyeh82.html what is happening in sudan africa ] [http://s1.shard.jp/galeach/new110.html asia vacation package tour ] [http://s1.shard.jp/losaul/epoxy-surfboards.html big pond australia ] [http://s1.shard.jp/olharder/auto-recreational.html organismos autotrofos y heterotrofos ] [http://s1.shard.jp/galeach/new113.html asian ladyboy o ] [http://s1.shard.jp/olharder/autoroll-654.html domain] [http://s1.shard.jp/frhorton/y8fj1syi7.html africa twin for sale ] [http://s1.shard.jp/losaul/planes-for-sale.html motor cycle parts australia ] [http://s1.shard.jp/frhorton/ybfhg5c59.html christian book shops south africa ] [http://s1.shard.jp/olharder/autobiographer.html parts plus auto stores ] [http://s1.shard.jp/galeach/new163.html university of maryland asian division ] [http://s1.shard.jp/olharder/autoroll-654.html top] [http://s1.shard.jp/bireba/ dod antivirus download ] [http://s1.shard.jp/frhorton/2i2g9o8vi.html african american monologues online ] [http://s1.shard.jp/losaul/idp-australia.html auction australian car government south ] [http://s1.shard.jp/losaul/quoin-int-australia.html visypak australia ] [http://s1.shard.jp/losaul/australia-credit.html australian dollars to dollars ] [http://s1.shard.jp/bireba/sonicwall-complete.html antivirus 2004 free download ] [http://s1.shard.jp/losaul/compare-flights.html important events in australian history ] [http://s1.shard.jp/galeach/new62.html epiphyseal dysplasias ] [http://s1.shard.jp/galeach/new44.html mtv+asia aid ] [http://s1.shard.jp/olharder/the-autobiography.html auto auctions new jersey ] [http://s1.shard.jp/losaul/i-still-call-australia.html australian single woman ] [http://s1.shard.jp/olharder/auto-ventashade.html household auto finance co ] [http://s1.shard.jp/losaul/alzeihmers-australia.html 21 australia century estate real ] [http://s1.shard.jp/losaul/informed-sources.html history of australian women ] [http://s1.shard.jp/galeach/new102.html krisia lukasiak ] [http://s1.shard.jp/losaul/australian-hotel.html australia ministry of tourism ] [http://s1.shard.jp/galeach/new38.html southeast asian tsunamis ] [http://s1.shard.jp/galeach/new95.html asian ts .com ] [http://s1.shard.jp/olharder/auto-bank-repossessed.html grand theft auto 5 san andreas ] [http://s1.shard.jp/olharder/automate-552.html viper auto alarm operators manual ] [http://s1.shard.jp/bireba/norton-antivirus.html norton antivirus free trialware] [http://s1.shard.jp/losaul/buffy-convention.html minerals council of australia ] [http://s1.shard.jp/olharder/autoroll-654.html http] [http://s1.shard.jp/galeach/new120.html euro asian furniture ] [http://s1.shard.jp/frhorton/mz6vv73zx.html antique maps of africa ] [http://s1.shard.jp/olharder/xp-autoplay-disable.html unique automotive shelby ] [http://s1.shard.jp/olharder/long-term-auto.html auto ebay part sale ] [http://s1.shard.jp/losaul/jamsteraustraliaautomarketsolcomau.html the sebel pier one sydney australia ] [http://s1.shard.jp/frhorton/qogtjly72.html african american native ] [http://s1.shard.jp/olharder/auto-sales-winnies.html mautofied ] [http://s1.shard.jp/losaul/email-directory.html australian sheep dog rescue ] [http://s1.shard.jp/frhorton/n6s8w7eys.html african american world war ii] [http://s1.shard.jp/olharder/automation-building.html autovantage rage road ] [http://s1.shard.jp/losaul/australian-oil.html australian surf lifesaving titles 2004 photos ] 

Revision as of 06:49, 3 June 2009

This is a Vulnerability. To view all vulnerabilities, please see the Vulnerability Category page.

Last revision (mm/dd/yy): 06/3/2009

Vulnerabilities Table of Contents


A signed-to-unsigned conversion error takes place when a signed primitive is used as an unsigned value, usually as a size variable.


  • Availability: Incorrect sign conversions generally lead to undefined behavior, and therefore crashes.
  • Integrity: If a poor cast leads to a buffer overflow or similar condition, data integrity may be affected.
  • Access control (instruction processing): Improper signed-to-unsigned conversions without proper checking can sometimes trigger buffer overflows which can be used to execute arbitrary code. This is usually outside the scope of a program's implicit security policy.

Exposure period

  • Requirements specification: The choice could be made to use a language that is not susceptible to these issues.
  • Design: Accessor functions may be designed to mitigate some of these logical issues.
  • Implementation: Many logic errors can lead to this condition. It can be exacerbated by lack, or misuse, of mitigating technologies.


  • Languages: C, C++, Fortran, Assembly
  • Operating platforms: All

Required resources




Likelihood of exploit


Often, functions will return negative values to indicate a failure state. In the case of functions which return values which are meant to be used as sizes, negative return values can have unexpected results. If these values are passed to the standard memory copy or allocation functions, they will implicitly cast the negative error, indicating value to a large unsigned value.

In the case of allocation, this may not be an issue; however, in the case of memory and string copy functions, this can lead to a buffer overflow condition which may be exploitable.

Also, if the variables in question are used as indexes into a buffer, it may result in a buffer underflow condition.

In the following example, it is possible to request that memcpy move a much larger segment of memory than assumed:

int returnChunkSize(void *) {
  /* if chunk info is valid, return the size of usable memory, 
   * else, return -1 to indicate an error

int main() {
  memcpy(destBuf, srcBuf, (returnChunkSize(destBuf)-1));

If returnChunkSize() happens to encounter an error, and returns -1, memcpy will assume that the value is unsigned and therefore interpret it as MAXINT-1, therefore copying far more memory than is likely available in the destination buffer.

Risk Factors




Related Attacks

Related Vulnerabilities

Related Controls

  • Requirements specification: Choose a language which is not subject to these casting flaws.
  • Design: Design object accessor functions to implicitly check values for valid sizes. Ensure that all functions which will be used as a size are checked previous to use as a size. If the language permits, throw exceptions rather than using in-band errors.
  • Implementation: Error check the return values of all functions. Be aware of implicit casts made, and use unsigned variables for sizes if at all possible.

Related Technical Impacts


Note: A reference to related CWE or CAPEC article should be added when exists. Eg: