Search

ParaSoft

HOME
PRODUCTS
SUPPORT
ABOUT
WHAT'S NEW
EVENTS


Insure++

Quick facts

Add-on Modules:
   -INUSE
   -TCA

Comparisons

Technical Papers

Support & Manuals

FAQs

Recent Reviews

User Testimonials

Press Releases


Insure tool to debug c++





Insure++ Reference - WRITE_OVERFLOW



WRITE_OVERFLOW

Writing overflows memory

This error is generated whenever a block of memory indicated by a pointer will be written outside its valid range.

Problem

This code attempts to copy a string into the array a, which is not large enough.

	1:	/*
	2:	 * File: writover.c
	3:	 */
	4:	main()
	5:	{
	6:		int junk;
	7:		char a[10];
	8:
	9:		strcpy(a, "A simple test"); bug
	10:		return (0);
	11:	}

Diagnosis (at runtime)

	[writeover.c:9] **WRITE_OVERFLOW**
1.	>> 		strcpy(a, "A simple test");
	
2.		Writing overflows memory: a
	
			bbbbbbbbbb
3.			|   10   |  4  |
			wwwwwwwwwwwwwwww
	
4.		Writing (w): 0xf7fffafc thru 0xf7fffb09 (14 bytes)
		To block(b): 0xf7fffafc thru 0xf7fffb05 (10 bytes)
			a, declared at writover.c, 7

5.		Stack trace where the error occurred:
			      strcpy() (interface)
				main() writover.c, 9
  1. Source line at which the problem was detected.
  2. Description of the problem and the incorrect expression.
  3. Schematic showing the relative layout of the actual memory block (b) and region being written (w). (See "Overflow diagrams".)
  4. Range of memory being written and description of the block to which write is taking place, including its size and the location of its declaration.
  5. Stack trace showing the call sequence leading to the error.

Repair

This error often occurs when working with strings.

In most cases, a simple fix is to increase the size of the destination object.


< WRITE_NULL > WRITE_UNINIT_PTR
Tools to debug c++ and java
(888) 305-0041 info@parasoft.com Copyright © 1996-2001 ParaSoft