× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Bruce Vining wrote:

Pop quiz to those of you familiar with system APIs. Can you find where four
bytes of storage are corrupted by this simple example? (I will admit that
due to current implementation of the RPG compiler this corruption will most
likely go undetected at run-time, but a compiler implementation change in
the future could toast any program using this example as a model for calling
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.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 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.