internal
| 752 | |
| 753 | // internal |
| 754 | bool CScriptArray::CheckMaxSize(asUINT numElements) |
| 755 | { |
| 756 | // This code makes sure the size of the buffer that is allocated |
| 757 | // for the array doesn't overflow and becomes smaller than requested |
| 758 | |
| 759 | asUINT maxSize = 0xFFFFFFFFul - sizeof(SArrayBuffer) + 1; |
| 760 | if( elementSize > 0 ) |
| 761 | maxSize /= elementSize; |
| 762 | |
| 763 | if( numElements > maxSize ) |
| 764 | { |
| 765 | asIScriptContext *ctx = asGetActiveContext(); |
| 766 | if( ctx ) |
| 767 | ctx->SetException("Too large array size"); |
| 768 | |
| 769 | return false; |
| 770 | } |
| 771 | |
| 772 | // OK |
| 773 | return true; |
| 774 | } |
| 775 | |
| 776 | asITypeInfo *CScriptArray::GetArrayObjectType() const |
| 777 | { |
nothing calls this directly
no outgoing calls
no test coverage detected