Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- enum ePools {
- BUILDING_POOL = 0,
- PED_POOL,
- OBJECT_POOL,
- DUMMY_POOL,
- VEHICLE_POOL,
- COL_MODEL_POOL,
- TASK_POOL,
- EVENT_POOL,
- TASK_ALLOCATOR_POOL,
- PED_INTELLIGENCE_POOL,
- PED_ATTRACTOR_POOL,
- ENTRY_INFO_NODE_POOL,
- NODE_ROUTE_POOL,
- PATROL_ROUTE_POOL,
- POINT_ROUTE_POOL,
- POINTER_DOUBLE_LINK_POOL,
- POINTER_SINGLE_LINK_POOL,
- ENV_MAP_MATERIAL_POOL,
- ENV_MAP_ATOMIC_POOL,
- SPEC_MAP_MATERIAL_POOL,
- MAX_POOLS
- };
- void CPoolsSA::DumpPoolsStatus ()
- {
- char* poolNames[] = {
- "Buildings", "Peds", "Objects", "Dummies", "Vehicles",
- "ColModels", "Tasks", "Events", "TaskAllocators",
- "PedIntelligences", "PedAttractors", "EntryInfoNodes",
- "NodeRoutes", "PatrolRoutes", "PointRoutes",
- "PointerNodeDoubleLinks", "PointerNodeSingleLinks" };
- int poolSizes[] = {
- 13000,140,350,2500,110,10150,500,200,16,140,64,500,
- 64,32,64,3200,70000 };
- int iPosition = 0;
- char percent = '%';
- iPosition += snprintf ( szOutput, 1024,
- "-----------------\n" );
- for ( int i = 0; i < MAX_POOLS; i++ )
- {
- int usedSpaces = GetNumberOfUsedSpaces ( (ePools)i );
- iPosition +=
- snprintf ( szOutput + iPosition, 1024 - iPosition,
- "%s: %d (%d) (%.2f%c)\n", poolNames[i],
- usedSpaces, poolSizes[i],
- ((float)usedSpaces/(float)poolSizes[i]*100),
- percent );
- }
- #ifdef MTA_DEBUG
- OutputDebugString ( szOutput );
- #endif
- }
- This suspicious code was found in MTASA project by PVS-Studio static code analyzer.
- Warning message is:
- V557 Array overrun is possible. The value of 'i' index could reach 19. cpoolssa.cpp 1036
- PVS-Studio is a static analyzer for detecting bugs in the source code of applications written in C, C++, C++11, C++/CX. Site: http://www.viva64.com/en/pvs-studio/
Advertisement
Add Comment
Please, Sign In to add comment