I once fixed a bug in a very popular application, it produced occasional bus errors on the S390 architecture. It turned out to be due to a piece of code of the form "buffer + len". The C standard requires that you be able to create pointers in that form pointing to any element in the allocated length, plus a single entry past the end. It does not guarantee that you can even compute the address of a pointer that lies outside this range. "ptr + int" calculation itself caused the bus error when the pointer lay near the end of the segment.
Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds