Function that checks classes for pointers
| 925 | |
| 926 | // Function that checks classes for pointers |
| 927 | void CheckClass(char* ptr, const NULLCTypeInfo& type) |
| 928 | { |
| 929 | const NULLCTypeInfo *realType = &type; |
| 930 | if(type.hash == objectName) |
| 931 | { |
| 932 | // Get real variable type |
| 933 | realType = &__nullcTypeList[*(int*)ptr]; |
| 934 | // Switch pointer to target |
| 935 | ptr = ((NULLCRef*)ptr)->ptr; |
| 936 | // If uninitialized or points to stack memory, return |
| 937 | if(!ptr || ptr <= (char*)0x00010000 || (ptr >= unmanageableBase && ptr <= unmanageableTop)) |
| 938 | return; |
| 939 | // Get base pointer |
| 940 | unsigned int *basePtr = (unsigned int*)NULLC::GetBasePointer(ptr); |
| 941 | // If there is no base pointer or memory already marked, exit |
| 942 | if(!basePtr || (*((unsigned int*)(basePtr) - 1) & 0xff)) |
| 943 | return; |
| 944 | // Mark memory as used |
| 945 | *((unsigned int*)(basePtr) - 1) |= 1; |
| 946 | // Fixup target |
| 947 | CheckVariable(ptr, *realType); |
| 948 | // Exit |
| 949 | return; |
| 950 | }else if(type.hash == autoArrayName){ |
| 951 | CheckArray(ptr, type); |
| 952 | // Exit |
| 953 | return; |
| 954 | } |
| 955 | // Get class member type list |
| 956 | unsigned int *memberList = &__nullcTypePart[realType->members]; |
| 957 | // Check pointer members |
| 958 | for(unsigned int n = 0; n < realType->memberCount; n++) |
| 959 | { |
| 960 | // Get member type |
| 961 | NULLCTypeInfo &subType = __nullcTypeList[memberList[n * 2]]; |
| 962 | unsigned int pos = memberList[n * 2 + 1]; |
| 963 | // Check member |
| 964 | CheckVariable(ptr + pos, subType); |
| 965 | } |
| 966 | } |
| 967 | |
| 968 | // Function that checks function context for pointers |
| 969 | void CheckFunction(char* ptr) |
no test coverage detected