@@ -29,7 +29,7 @@ from BufferAccess ba, string bufferDesc, int accessSize, int accessType,
2929where accessSize = ba .getSize ( )
3030 and bufferSize = getBufferSize ( ba .getBuffer ( bufferDesc , accessType ) ,
3131 bufferAlloc )
32- and accessSize > bufferSize
32+ and ( accessSize > bufferSize or ( accessSize <= 0 and accessType = 3 ) )
3333 and if accessType = 1 then (
3434 message = "This '" + ba .getName ( ) + "' operation accesses "
3535 + plural ( accessSize , " byte" , " bytes" )
@@ -41,8 +41,13 @@ where accessSize = ba.getSize()
4141 + " but the $@ is only "
4242 + plural ( bufferSize , " byte" , " bytes" ) + "."
4343 ) else (
44- message = "This array indexing operation accesses byte offset "
45- + ( accessSize - 1 ) + " but the $@ is only "
46- + plural ( bufferSize , " byte" , " bytes" ) + "."
44+ if accessSize > 0 then (
45+ message = "This array indexing operation accesses byte offset "
46+ + ( accessSize - 1 ) + " but the $@ is only "
47+ + plural ( bufferSize , " byte" , " bytes" ) + "."
48+ ) else (
49+ message = "This array indexing operation accesses a negative index "
50+ + ( ( accessSize / ba .getActualType ( ) .getSize ( ) ) - 1 ) + " on the $@."
51+ )
4752 )
4853select ba , message , bufferAlloc , bufferDesc
0 commit comments