VirtualBox

Ignore:
Timestamp:
Apr 18, 2018 4:22:34 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
122141
Message:

3D: bugref:9096, Chromium code cleanup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_program.c

    r69390 r71903  
    4343        GLuint index = READ_DATA(12, GLuint);
    4444        GLuint num = READ_DATA(16, GLuint);
    45         GLdouble *params = (GLdouble *) crAlloc(num * 4 * sizeof(GLdouble));
     45    GLdouble *params;
     46
     47    if (num >= UINT32_MAX / (4 * sizeof(GLdouble)))
     48    {
     49        crError("crUnpackExtendProgramParameters4dvNV: parameter 'num' is out of range");
     50        return;
     51    }
     52
     53    params = (GLdouble *)crAlloc(num * 4 * sizeof(GLdouble));
     54
    4655        if (params) {
    4756                GLuint i;
    4857                for (i = 0; i < 4 * num; i++) {
    49                         params[i] = READ_DATA(20 + i * 8, GLdouble);
     58            params[i] = READ_DATA(20 + i * sizeof(GLdouble), GLdouble);
    5059                }
    5160                cr_unpackDispatch.ProgramParameters4dvNV(target, index, num, params);
     
    6069        GLuint index = READ_DATA(12, GLuint);
    6170        GLuint num = READ_DATA(16, GLuint);
    62         GLfloat *params = (GLfloat *) crAlloc(num * 4 * sizeof(GLfloat));
     71    GLfloat *params;
     72
     73    if (num >= UINT32_MAX / (4 * sizeof(GLfloat)))
     74    {
     75        crError("crUnpackExtendProgramParameters4fvNV: parameter 'num' is out of range");
     76        return;
     77    }
     78
     79    params = (GLfloat *)crAlloc(num * 4 * sizeof(GLfloat));
     80
    6381        if (params) {
    6482                GLuint i;
    6583                for (i = 0; i < 4 * num; i++) {
    66                         params[i] = READ_DATA(20 + i * 4, GLfloat);
     84            params[i] = READ_DATA(20 + i * sizeof(GLfloat), GLfloat);
    6785                }
    6886                cr_unpackDispatch.ProgramParameters4fvNV(target, index, num, params);
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette