i, lp[i], i+1, ip[i+1], j, ip[j]);

^

Catch out-of-bounds pointer access through an uninitialized variable (the uninitialized variable can be checked by +check=uninit):

$ RTC_NO_ABORT=1 a.out 2

Runtime Error: out of bounds buffer pointed by 0x40010320 has 40 bytes (variable "a"), reading at 0x40010320-19824, 4 bytes ("rttest3.c", line 33)

(0)0x0000000004004770 _rtc_raise_fault + 0x560 at rtc_utils.c:164 [./a.out](1) 0x0000000004008790 _rtc_oob_check_unknown_bounds + 0x1f0 at rtc_bounds.c:465 [./a.out]

(2)0x0000000004003920 main + 0x330 at rttest3.c:33 [./a.out]

(3)0x60000000c0049c50 main_opd_entry + 0x50 [/usr/lib/hpux32/dld.so] Memory fault(coredump)

Check off by one out-of-bounds access:

$ RTC_NO_ABORT=1 a.out 10

Runtime Error: out of bounds buffer pointed by 0x400a1890 has 40 bytes

(allocation stack trace: 0x040035c2, 0x04003612, 0xc0049c42), writing at 0x400a1890+40, 4 bytes ("rttest3.c", line 29)

(0)0x0000000004004770 _rtc_raise_fault + 0x560 at rtc_utils.c:164 [./a.out]

(1)0x0000000004008790 _rtc_oob_check_unknown_bounds + 0x1f0 at rtc_bounds.c:465 [./a.out]

(2)0x00000000040037b0 main + 0x1c0 at rttest3.c:29 [./a.out]

(3)0x60000000c0049c50 main_opd_entry + 0x50 [/usr/lib/hpux32/dld.so]

Runtime Error: out of bounds buffer pointed by 0x40010320 has 40 bytes (variable "a"), writing at 0x40010320+44, 4 bytes ("rttest3.c", line 31)

(0)0x0000000004004770 _rtc_raise_fault + 0x560 at rtc_utils.c:164 [./a.out]

(1)0x0000000004008790 _rtc_oob_check_unknown_bounds + 0x1f0 at rtc_bounds.c:465 [./a.out]

(2)0x0000000004003810 main + 0x220 at rttest3.c:31 [./a.out]

(3)0x60000000c0049c50 main_opd_entry + 0x50 [/usr/lib/hpux32/dld.so]

Runtime Error: out of bounds buffer pointed by 0x400a1890 has 40 bytes

(allocation stack trace: 0x040035c2, 0x04003612, 0xc0049c42), reading at 0x400a1890+40, 4 bytes ("rttest3.c", line 33)

(0)0x0000000004004770 _rtc_raise_fault + 0x560 at rtc_utils.c:164 [./a.out]

(1)0x0000000004008790 _rtc_oob_check_unknown_bounds + 0x1f0 at rtc_bounds.c:465 [./a.out]

(2)0x00000000040038a0 main + 0x2b0 at rttest3.c:33 [./a.out]

(3)0x60000000c0049c50 main_opd_entry + 0x50 [/usr/lib/hpux32/dld.so]

Runtime Error: out of bounds buffer pointed by 0x40010320 has 40 bytes (variable "a"), reading at 0x40010320+44, 4 bytes ("rttest3.c", line 33)

(0)0x0000000004004770 _rtc_raise_fault + 0x560 at rtc_utils.c:164 [./a.out]

(1)0x0000000004008790 _rtc_oob_check_unknown_bounds + 0x1f0 at rtc_bounds.c:465 [./a.out]

(2)0x00000000040038f0 main + 0x300 at rttest3.c:33 [./a.out]

(3)0x60000000c0049c50 main_opd_entry + 0x50 [/usr/lib/hpux32/dld.so]

Runtime Error: out of bounds buffer pointed by 0x40010320 has 40 bytes (variable "a"), reading at 0x40010320-19824, 4 bytes ("rttest3.c", line 33)

(0)0x0000000004004770 _rtc_raise_fault + 0x560 at rtc_utils.c:164 [./a.out]

(1)0x0000000004008790 _rtc_oob_check_unknown_bounds + 0x1f0 at rtc_bounds.c:465 [./a.out]

(2)0x0000000004003920 main + 0x330 at rttest3.c:33 [./a.out]

(3)0x60000000c0049c50 main_opd_entry + 0x50 [/usr/lib/hpux32/dld.so] Memory fault(coredump)

Check off by any number out-of-bounds access:

Runtime Checking Options 77

Page 77
Image 77
HP C/aC++ for PA-RISC Software manual Check off by one out-of-bounds access, Check off by any number out-of-bounds access