|
Bruce Vining wrote:
four
Pop quiz to those of you familiar with system APIs. Can you find where
bytes of storage are corrupted by this simple example? (I will admit thatmost
due to current implementation of the RPG compiler this corruption will
likely go undetected at run-time, but a compiler implementation change incalling
the future could toast any program using this example as a model for
sysem APIs -- corruption is corruption)
Good catch!
I think it could quite easily lead to detectable corruption at runtime
already, and I don't think it would be limited to only 4 bytes.
The prototype for the error code parameter is 1a const, and a blank is
being passed. The compiler will create a 1-byte temporary and set it to
blank (x'40') and pass the address. No matter what the following 3
bytes contains, the API will find that the bytes-provided subfield of
the error code is at least x'40000000' (1073741824), and will be free to
update that much storage starting at the 1-byte temporary.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.