Changeset 71468 in vbox for trunk/src/VBox/HostServices/SharedOpenGL
- Timestamp:
- Mar 22, 2018 6:48:08 PM (7 years ago)
- Location:
- trunk/src/VBox/HostServices/SharedOpenGL
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_boundsinfo.c
r69390 r71468 297 297 crServerSetOutputBounds( mural, mural->curExtent ); 298 298 } 299 crUnpack( data_ptr, data_ptr-1, num_opcodes, &(cr_server.dispatch) );299 crUnpack( data_ptr, NULL, data_ptr-1, num_opcodes, &(cr_server.dispatch) ); 300 300 } 301 301 } … … 320 320 crServerSetOutputBounds( mural, i ); 321 321 } 322 crUnpack( data_ptr, data_ptr-1, num_opcodes, &(cr_server.dispatch) );322 crUnpack( data_ptr, NULL, data_ptr-1, num_opcodes, &(cr_server.dispatch) ); 323 323 } 324 324 } -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_stream.c
r69390 r71468 559 559 const CRMessageOpcodes *msg_opcodes; 560 560 int opcodeBytes; 561 const char *data_ptr ;561 const char *data_ptr, *data_ptr_end; 562 562 563 563 RTListNodeRemove(&pIter->Node); … … 569 569 570 570 data_ptr = (const char *) msg_opcodes + sizeof (CRMessageOpcodes) + opcodeBytes; 571 data_ptr_end = (const char *)msg_opcodes + pIter->cbMsg; 571 572 572 573 crUnpack(data_ptr, /* first command's operands */ 574 data_ptr_end, /* first byte after command's operands*/ 573 575 data_ptr - 1, /* first command's opcode */ 574 576 msg_opcodes->numOpcodes, /* how many opcodes */ … … 590 592 const CRMessageOpcodes *msg_opcodes; 591 593 int opcodeBytes; 592 const char *data_ptr ;594 const char *data_ptr, *data_ptr_end; 593 595 #ifdef VBOX_WITH_CRHGSMI 594 596 PCRVBOXHGSMI_CMDDATA pCmdData = NULL; … … 616 618 617 619 data_ptr = (const char *) msg_opcodes + sizeof(CRMessageOpcodes) + opcodeBytes; 620 data_ptr_end = (const char *)msg_opcodes + cbMsg; // Pointer to the first byte after message data 618 621 619 622 enmType = crUnpackGetBufferType(data_ptr - 1, /* first command's opcode */ … … 677 680 { 678 681 crUnpack(data_ptr, /* first command's operands */ 682 data_ptr_end, /* first byte after command's operands*/ 679 683 data_ptr - 1, /* first command's opcode */ 680 684 msg_opcodes->numOpcodes, /* how many opcodes */ -
trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack.py
r69390 r71468 26 26 27 27 DECLEXPORT(const unsigned char *) cr_unpackData = NULL; 28 DECLEXPORT(const unsigned char *) cr_unpackDataEnd = NULL; 28 29 SPUDispatchTable cr_unpackDispatch; 29 30 … … 240 241 } 241 242 242 void crUnpack( const void *data, const void * opcodes,243 void crUnpack( const void *data, const void *data_end, const void *opcodes, 243 244 unsigned int num_opcodes, SPUDispatchTable *table ) 244 245 { … … 253 254 unpack_opcodes = (const unsigned char *)opcodes; 254 255 cr_unpackData = (const unsigned char *)data; 256 cr_unpackDataEnd = (const unsigned char *)data; 255 257 256 258 #if defined(CR_UNPACK_DEBUG_OPCODES) || defined(CR_UNPACK_DEBUG_LAST_OPCODES) -
trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_shaders.c
r71462 r71468 41 41 char **ppStrings = NULL; 42 42 GLsizei i, j, jUpTo; 43 int pos=20+count*sizeof(*pLocalLength); 44 45 if (hasNonLocalLen>0) 46 { 47 length = DATA_POINTER(pos, GLint); 48 pos += count*sizeof(*length); 49 } 50 51 if (count >= UINT32_MAX / sizeof(char*)) 43 int pos, pos_check; 44 45 if (count >= UINT32_MAX / sizeof(char *) / 4) 52 46 { 53 47 crError("crUnpackExtendShaderSource: count %u is out of range", count); … … 55 49 } 56 50 57 ppStrings = crAlloc(count*sizeof(char*)); 51 pos = 20 + count * sizeof(*pLocalLength); 52 53 if (hasNonLocalLen > 0) 54 { 55 length = DATA_POINTER(pos, GLint); 56 pos += count * sizeof(*length); 57 } 58 59 pos_check = pos; 60 61 if (!DATA_POINTER_CHECK(pos_check)) 62 { 63 crError("crUnpackExtendShaderSource: pos %d is out of range", pos_check); 64 return; 65 } 66 67 for (i = 0; i < count; ++i) 68 { 69 if (pLocalLength[i] <= 0 || pos_check >= INT32_MAX - pLocalLength[i] || !DATA_POINTER_CHECK(pos_check)) 70 { 71 crError("crUnpackExtendShaderSource: pos %d is out of range", pos_check); 72 return; 73 } 74 75 pos_check += pLocalLength[i]; 76 } 77 78 ppStrings = crAlloc(count * sizeof(char*)); 58 79 if (!ppStrings) return; 59 80 60 for (i =0; i<count; ++i)81 for (i = 0; i < count; ++i) 61 82 { 62 83 ppStrings[i] = DATA_POINTER(pos, char);
Note:
See TracChangeset
for help on using the changeset viewer.