HP3000-L Archives

April 2002, Week 1

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Tom Brandt <[log in to unmask]>
Reply To:
Tom Brandt <[log in to unmask]>
Date:
Thu, 4 Apr 2002 11:23:05 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (39 lines)
No. The $CONTROL BOUNDS tells the compiler to generate code to test whether
indices and subscripts are valid, and whether the start and length specs
are valid for reference modification.  This prevents the program from
indexing beyond the end of an array, for example. However, when an IMAGE
call is made, control is handed off to IMAGE, and IMAGE will just start
moving data beginning at the address where the calling program told it to
start. It has no idea how wide the buffer is.

At 11:11 AM 4/4/2002 -0500, Joan Entwistle wrote:
>Would using $CONTROL BOUNDS on the COBOL compile catch this?
>
>Plenty of people have already indicated that what you get is extremely
>unpredictable program behavior, due to overwriting of whatever data space
>happens to be "to the right" of your buffer area. I've seen people get bit
>on this when the dataset record length increases and the buffer definition
>does not get changed accordingly. This can 'lurk' for a long time as that
>occasional bug that can't be reproduced in captivity, or it could just
>plain cause something obvious like an abort.
>
>There are coding methods to help prevent this problem, such as defining the
>dataset structure once and only once in an $include or copylib. In FORTRAN,
>you can also code a test for this by combining the proper Image calls
>(dbinfo, etc.) with the LEN function ("LEN(IMAGEBUFFER)"). That is, code to
>determine the number of bytes to be returned and compare it to the actual
>buffer length.
>
>
>-dtd

--------------------------------
Tom Brandt
Northtech Systems, Inc.
313 N. 1st Street
Ann Arbor, MI 48103
http://www.northtech.com/

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2