Changeset 76787 in vbox
- Timestamp:
- Jan 11, 2019 8:00:15 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 128124
- Location:
- trunk/src/VBox
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/OpenGL/include/cr_unpack.h
r73223 r76787 70 70 71 71 #define DATA_POINTER_CHECK( offset ) \ 72 ( ( offset) >= 0 && (cr_unpackDataEnd >= cr_unpackData) && (size_t)(cr_unpackDataEnd - cr_unpackData) >(size_t)(offset) )72 ( (cr_unpackDataEnd >= cr_unpackData) && (size_t)(cr_unpackDataEnd - cr_unpackData) >= (size_t)(offset) ) 73 73 74 74 #define INCR_DATA_PTR( delta ) \ -
trunk/src/VBox/HostServices/SharedOpenGL/crserver/crservice.cpp
r76553 r76787 367 367 if (pBuffer) 368 368 { 369 pBuffer->pData = RTMemAlloc(cbBufferSize); 369 /* Filling host buffer with zeroes to prevent possible host->guest memory disclosure */ 370 pBuffer->pData = RTMemAllocZ(cbBufferSize); 370 371 if (!pBuffer->pData) 371 372 { -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_bufferobject.c
r74890 r76787 29 29 (void) buffers; 30 30 31 if (n >= INT32_MAX / sizeof(GLuint))31 if (n <= 0 || n >= INT32_MAX / sizeof(GLuint)) 32 32 { 33 33 crError("crServerDispatchGenBuffersARB: parameter 'n' is out of range"); … … 68 68 void *b; 69 69 70 if (size <= 0 || size >= INT32_MAX / 2) 71 { 72 crError("crServerDispatchGetBufferSubDataARB: size is out of range"); 73 return; 74 } 75 70 76 b = crCalloc(size); 77 71 78 if (b) { 72 79 cr_server.head_spu->dispatch_table.GetBufferSubDataARB( target, offset, size, b ); -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_framebuffer.c
r76553 r76787 29 29 (void) framebuffers; 30 30 31 if (n >= INT32_MAX / sizeof(GLuint))31 if (n <= 0 || n >= INT32_MAX / sizeof(GLuint)) 32 32 { 33 33 crError("crServerDispatchGenFramebuffersEXT: parameter 'n' is out of range"); … … 49 49 (void) renderbuffers; 50 50 51 if (n >= INT32_MAX / sizeof(GLuint))51 if (n <= 0 || n >= INT32_MAX / sizeof(GLuint)) 52 52 { 53 53 crError("crServerDispatchGenRenderbuffersEXT: parameter 'n' is out of range"); -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_gentextures.c
r74890 r76787 17 17 (void) textures; 18 18 19 if (n >= INT32_MAX / sizeof(GLuint))19 if (n <= 0 || n >= INT32_MAX / sizeof(GLuint)) 20 20 { 21 21 crError("crServerDispatchGenTextures: parameter 'n' is out of range"); … … 42 42 (void) ids; 43 43 44 if (n >= INT32_MAX / sizeof(GLuint))44 if (n <= 0 || n >= INT32_MAX / sizeof(GLuint)) 45 45 { 46 46 crError("crServerDispatchGenProgramsNV: parameter 'n' is out of range"); … … 67 67 (void) ids; 68 68 69 if (n >= INT32_MAX / sizeof(GLuint))69 if (n <= 0 || n >= INT32_MAX / sizeof(GLuint)) 70 70 { 71 71 crError("crServerDispatchGenFencesNV: parameter 'n' is out of range"); … … 88 88 void SERVER_DISPATCH_APIENTRY crServerDispatchGenProgramsARB( GLsizei n, GLuint * ids ) 89 89 { 90 GLuint *local_progs = (GLuint *) crAlloc( n*sizeof( *local_progs) );90 GLuint *local_progs; 91 91 GLsizei i; 92 92 (void) ids; 93 93 94 if (n >= INT32_MAX / sizeof(GLuint))94 if (n <= 0 || n >= INT32_MAX / sizeof(GLuint)) 95 95 { 96 96 crError("crServerDispatchGenProgramsARB: parameter 'n' is out of range"); … … 102 102 if (!local_progs) 103 103 { 104 crError("crServerDispatchGenProgramsARB: out of m emory");104 crError("crServerDispatchGenProgramsARB: out of money"); 105 105 return; 106 106 } … … 120 120 } 121 121 122 crServerReturnValue( local_progs, n *sizeof( *local_progs ) );122 crServerReturnValue( local_progs, n * sizeof( *local_progs ) ); 123 123 crFree( local_progs ); 124 124 } -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_getshaders.c
r76553 r76787 39 39 crGetActive_t *pLocal = NULL; 40 40 41 if (bufSize < INT32_MAX / 2)41 if (bufSize > 0 && bufSize < INT32_MAX / 2) 42 42 pLocal = (crGetActive_t*)crCalloc(bufSize + sizeof(crGetActive_t)); 43 43 … … 59 59 crGetActive_t *pLocal = NULL; 60 60 61 if (bufSize < INT32_MAX / 2)61 if (bufSize > 0 && bufSize < INT32_MAX / 2) 62 62 pLocal = (crGetActive_t*) crCalloc(bufSize + sizeof(crGetActive_t)); 63 63 … … 79 79 GLsizei *pLocal = NULL; 80 80 81 if (maxCount < INT32_MAX / sizeof(GLuint) / 2)81 if (maxCount > 0 && maxCount < INT32_MAX / sizeof(GLuint) / 2) 82 82 pLocal = (GLsizei*) crCalloc(maxCount * sizeof(GLuint) + sizeof(GLsizei)); 83 83 … … 108 108 GLsizei *pLocal = NULL; 109 109 110 if (maxCount < INT32_MAX / sizeof(VBoxGLhandleARB) / 2)110 if (maxCount > 0 && maxCount < INT32_MAX / sizeof(VBoxGLhandleARB) / 2) 111 111 pLocal = (GLsizei*) crCalloc(maxCount * sizeof(VBoxGLhandleARB) + sizeof(GLsizei)); 112 112 … … 140 140 GLuint hwid; 141 141 142 if (maxLength < INT32_MAX / 2)142 if (maxLength > 0 && maxLength < INT32_MAX / 2) 143 143 pLocal = (GLsizei*) crCalloc(maxLength + sizeof(GLsizei)); 144 144 … … 164 164 GLsizei *pLocal = NULL; 165 165 166 if (bufSize < INT32_MAX / 2)166 if (bufSize > 0 && bufSize < INT32_MAX / 2) 167 167 pLocal = (GLsizei*) crCalloc(bufSize + sizeof(GLsizei)); 168 168 … … 184 184 GLsizei *pLocal = NULL; 185 185 186 if (bufSize < INT32_MAX / 2)186 if (bufSize > 0 && bufSize < INT32_MAX / 2) 187 187 pLocal = (GLsizei*) crCalloc(bufSize + sizeof(GLsizei)); 188 188 … … 205 205 GLsizei *pLocal = NULL; 206 206 207 if (bufSize < INT32_MAX / 2)207 if (bufSize > 0 && bufSize < INT32_MAX / 2) 208 208 pLocal = (GLsizei*) crCalloc(bufSize + sizeof(GLsizei)); 209 209 … … 230 230 (void) pData; 231 231 232 if (maxcbData < INT32_MAX / 2)232 if (maxcbData > 0 && maxcbData < INT32_MAX / 2) 233 233 pLocal = (GLsizei*) crCalloc(maxcbData + sizeof(GLsizei)); 234 234 … … 256 256 (void) pData; 257 257 258 if (maxcbData < INT32_MAX / 2)258 if (maxcbData > 0 && maxcbData < INT32_MAX / 2) 259 259 pLocal = (GLsizei*) crCalloc(maxcbData + sizeof(GLsizei)); 260 260 -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_glsl.c
r76553 r76787 182 182 GLint i; 183 183 184 if (n >= INT32_MAX / sizeof(GLuint))184 if (n <= 0 || n >= INT32_MAX / sizeof(GLuint)) 185 185 { 186 186 crError("crServerDispatchDeleteProgramsARB: parameter 'n' is out of range"); … … 223 223 (void) residences; 224 224 225 if (n >= INT32_MAX / sizeof(GLuint))225 if (n <= 0 || n >= INT32_MAX / sizeof(GLuint)) 226 226 { 227 227 crError("crServerDispatchAreProgramsResidentNV: parameter 'n' is out of range"); -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_lists.c
r74890 r76787 230 230 crServerDispatchCallLists( GLsizei n, GLenum type, const GLvoid *lists ) 231 231 { 232 if (n >= INT32_MAX / sizeof(GLuint))232 if (n <= 0 || n >= INT32_MAX / sizeof(GLuint)) 233 233 { 234 234 crError("crServerDispatchCallLists: parameter 'n' is out of range"); -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_occlude.c
r74890 r76787 17 17 (void) queries; 18 18 19 if (n >= INT32_MAX / sizeof(GLuint))19 if (n <= 0 || n >= INT32_MAX / sizeof(GLuint)) 20 20 { 21 21 crError("crServerDispatchGenQueriesARB: parameter 'n' is out of range"); -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_readpixels.c
r74890 r76787 49 49 uint32_t msg_len; 50 50 51 if (bytes_per_row < 0 || bytes_per_row > UINT32_MAX / 8 || height > UINT32_MAX / 8)51 if (bytes_per_row <= 0 || height <= 0 || bytes_per_row > INT32_MAX / height) 52 52 { 53 53 crError("crServerDispatchReadPixels: parameters out of range"); -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_texture.c
r76553 r76787 169 169 void SERVER_DISPATCH_APIENTRY crServerDispatchGetTexEnvfv( GLenum target, GLenum pname, GLfloat * params ) 170 170 { 171 GLfloat local_params[4] ;171 GLfloat local_params[4] = {0}; 172 172 (void) params; 173 173 if (GL_POINT_SPRITE != target && pname != GL_COORD_REPLACE) … … 181 181 void SERVER_DISPATCH_APIENTRY crServerDispatchGetTexEnviv( GLenum target, GLenum pname, GLint * params ) 182 182 { 183 GLint local_params[4] ;183 GLint local_params[4] = {0}; 184 184 (void) params; 185 185 if (GL_POINT_SPRITE != target && pname != GL_COORD_REPLACE) … … 203 203 GLint i; 204 204 205 if (n >= UINT32_MAX / sizeof(GLuint))205 if (n <= 0 || n >= INT32_MAX / sizeof(GLuint)) 206 206 { 207 207 crError("crServerDispatchDeleteTextures: parameter 'n' is out of range"); … … 239 239 GLint i; 240 240 241 if (n >= INT32_MAX / sizeof(GLuint))241 if (n <= 0 || n >= INT32_MAX / sizeof(GLuint)) 242 242 { 243 243 crError("crServerDispatchPrioritizeTextures: parameter 'n' is out of range"); … … 285 285 (void) residences; 286 286 287 if (n >= INT32_MAX / sizeof(GLuint))287 if (n <= 0 || n >= INT32_MAX / sizeof(GLuint)) 288 288 { 289 289 crError("crServerDispatchAreTexturesResident: parameter 'n' is out of range"); -
trunk/src/VBox/HostServices/SharedOpenGL/dlm/dlm_lists.c
r76553 r76787 354 354 crDebug("DLM: CallLists(%d, %u, %p).", n, type, lists); 355 355 356 if (n >= INT32_MAX / sizeof(GLuint))356 if (n <= 0 || n >= INT32_MAX / sizeof(GLuint)) 357 357 { 358 358 crError("crDLMCallLists: parameter 'n' is out of range"); -
trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_map.c
r74890 r76787 35 35 36 36 cbMax = (ustride * uorder + vstride * vorder) * sizeof(double); 37 if (!DATA_POINTER_CHECK(cbMax - 1))37 if (!DATA_POINTER_CHECK(cbMax)) 38 38 { 39 39 crError("crUnpackMap2d: parameters out of range"); … … 70 70 71 71 cbMax = (ustride * uorder + vstride * vorder) * sizeof(float); 72 if (!DATA_POINTER_CHECK(cbMax - 1))72 if (!DATA_POINTER_CHECK(cbMax)) 73 73 { 74 74 crError("crUnpackMap2f: parameters out of range"); … … 99 99 100 100 cbMax = stride * order * sizeof(double); 101 if (!DATA_POINTER_CHECK(cbMax - 1))101 if (!DATA_POINTER_CHECK(cbMax)) 102 102 { 103 103 crError("crUnpackMap1d: parameters out of range"); … … 128 128 129 129 cbMax = stride * order * sizeof(float); 130 if (!DATA_POINTER_CHECK(cbMax - 1))130 if (!DATA_POINTER_CHECK(cbMax)) 131 131 { 132 132 crError("crUnpackMap1f: parameters out of range"); -
trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_program.c
r73223 r76787 45 45 GLdouble *params; 46 46 47 if (num >= UINT32_MAX / (4 * sizeof(GLdouble)))47 if (num <= 0 || num >= INT32_MAX / (4 * sizeof(GLdouble))) 48 48 { 49 49 crError("crUnpackExtendProgramParameters4dvNV: parameter 'num' is out of range"); … … 71 71 GLfloat *params; 72 72 73 if (num >= UINT32_MAX / (4 * sizeof(GLfloat)))73 if (num <= 0 || num >= INT32_MAX / (4 * sizeof(GLfloat))) 74 74 { 75 75 crError("crUnpackExtendProgramParameters4fvNV: parameter 'num' is out of range"); … … 95 95 const GLuint *programs = DATA_POINTER(12, const GLuint); 96 96 97 if (n > UINT32_MAX / sizeof(GLuint) / 4 || !DATA_POINTER_CHECK(20 + n * sizeof(GLuint)))97 if (n <= 0 || n >= INT32_MAX / sizeof(GLuint) / 4 || !DATA_POINTER_CHECK(20 + n * sizeof(GLuint))) 98 98 { 99 99 crError("crUnpackExtendAreProgramsResidentNV: %d is out of range", n); … … 226 226 const GLubyte *name = DATA_POINTER(16, GLubyte); 227 227 228 if (len > UINT32_MAX / 4 || !DATA_POINTER_CHECK(16 + len + 8))228 if (len <= 0 || len >= INT32_MAX / 4 || !DATA_POINTER_CHECK(16 + len + 8)) 229 229 { 230 230 crError("crUnpackExtendGetProgramNamedParameterdvNV: len %d is out of range", len); … … 243 243 const GLubyte *name = DATA_POINTER(16, GLubyte); 244 244 245 if (len > UINT32_MAX / 4 || !DATA_POINTER_CHECK(16 + len + 8))245 if (len <= 0 || len >= INT32_MAX / 4 || !DATA_POINTER_CHECK(16 + len + 8)) 246 246 { 247 247 crError("crUnpackExtendGetProgramNamedParameterfvNV: len %d is out of range", len); -
trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_shaders.c
r76553 r76787 43 43 int pos, pos_check; 44 44 45 if (count >= UINT32_MAX / sizeof(char *) / 4)45 if (count <= 0 || count >= INT32_MAX / sizeof(char *) / 4) 46 46 { 47 47 crError("crUnpackExtendShaderSource: count %u is out of range", count); … … 339 339 GLuint program = READ_DATA(8, GLuint); 340 340 const char *name = DATA_POINTER(12, const char); 341 342 if (!DATA_POINTER_CHECK(packet_length)) 343 { 344 crError("crUnpackExtendGetAttribLocation: packet_length is out of range"); 345 return; 346 } 347 341 348 SET_RETURN_PTR(packet_length-16); 342 349 SET_WRITEBACK_PTR(packet_length-8); … … 349 356 GLuint program = READ_DATA(8, GLuint); 350 357 const char *name = DATA_POINTER(12, const char); 358 359 if (!DATA_POINTER_CHECK(packet_length)) 360 { 361 crError("crUnpackExtendGetUniformLocation: packet_length is out of range"); 362 return; 363 } 364 351 365 SET_RETURN_PTR(packet_length-16); 352 366 SET_WRITEBACK_PTR(packet_length-8); -
trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_texture.c
r73223 r76787 328 328 const GLuint *textures = DATA_POINTER( 12, const GLuint ); 329 329 330 if (n > UINT32_MAX / sizeof(GLuint) / 4 || !DATA_POINTER_CHECK(20 + n * sizeof(GLuint)))330 if (n <= 0 || n >= INT32_MAX / sizeof(GLuint) / 4 || !DATA_POINTER_CHECK(20 + n * sizeof(GLuint))) 331 331 { 332 332 crError("crUnpackExtendAreTexturesResident: %d is out of range", n); -
trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_visibleregion.c
r76553 r76787 26 26 GLint window = READ_DATA( 8, GLint ); 27 27 GLint cRects = READ_DATA( 12, GLint ); 28 GLvoid *pRects = DATA_POINTER( 16, GLvoid );; 28 GLvoid *pRects = DATA_POINTER( 16, GLvoid ); 29 30 if (cRects <= 0 || cRects >= INT32_MAX / sizeof(GLint) / 8 || !DATA_POINTER_CHECK(16 + 4 * cRects * sizeof(GLint))) 31 { 32 crError("crUnpackExtendWindowVisibleRegion: parameter 'cRects' is out of range"); 33 return; 34 } 35 29 36 cr_unpackDispatch.WindowVisibleRegion( window, cRects, pRects ); 30 37 }
Note:
See TracChangeset
for help on using the changeset viewer.