Changeset 79339 in vbox
- Timestamp:
- Jun 26, 2019 7:26:50 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/server_presenter.cpp
r78375 r79339 146 146 static int8_t crFbImgFromDimOffVramBGRA(VBOXCMDVBVAOFFSET offVRAM, uint32_t width, uint32_t height, CR_BLITTER_IMG *pImg) 147 147 { 148 uint32_t cbBuff; 149 150 if (width == 0 || height == 0) 151 { 152 WARN(("invalid param")); 148 if (offVRAM >= g_cbVRam) 149 { 150 WARN(("offVRAM invalid")); 153 151 return -1; 154 152 } 155 153 156 cbBuff = width * height * 4; 157 // Check if overflow happened 158 if (cbBuff / width != height * 4) 159 { 160 WARN(("invalid param")); 161 return -1; 162 } 163 164 if (offVRAM >= g_cbVRam 165 || UINT32_MAX - cbBuff <= offVRAM 166 || offVRAM + cbBuff >= g_cbVRam) 167 { 168 WARN(("invalid param")); 154 uint32_t const cbAvailVRAM = g_cbVRam - offVRAM; 155 uint32_t const cAvailScanlines = width ? cbAvailVRAM / (width * 4) : height; 156 if (height > cAvailScanlines) 157 { 158 WARN(("Not enough space in VRAM")); 169 159 return -1; 170 160 }
Note:
See TracChangeset
for help on using the changeset viewer.