VirtualBox

Ignore:
Timestamp:
Apr 10, 2019 11:20:02 AM (6 years ago)
Author:
vboxsync
Message:

GuestHost/OpenGL,HostServices/SharedOpenGL: Fixed parameter validation, bugref:9433

Location:
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_get.py

    r69390 r78076  
    127127        local_argname = 'local_%s' % lastParam[0]
    128128
    129         print('\t%s %s[%d];' % ( local_argtype, local_argname, max_components[func_name] ))
     129        print('\t%s %s[%d] = { 0 };' % ( local_argtype, local_argname, max_components[func_name] ))
    130130        print('\t(void) %s;' % lastParam[0])
    131131
     
    142142            print('\tcrServerReturnValue(&(%s[0]), %d*sizeof(%s));' % (local_argname, max_components[func_name], local_argtype ))
    143143        else:
    144             print('\tcrServerReturnValue(&(%s[0]), crStateHlpComponentsCount(pname)*sizeof(%s));' % (local_argname, local_argtype ))
     144            print('\tunsigned int cComponents = RT_MIN(crStateHlpComponentsCount(pname), RT_ELEMENTS(%s));' % local_argname)
     145            print('\tcrServerReturnValue(&(%s[0]), cComponents*sizeof(%s));' % (local_argname, local_argtype ))
    145146        print ('}\n')
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_texture.c

    r76787 r78076  
    176176        crStateGetTexEnvfv( target, pname, local_params );
    177177
    178     crServerReturnValue( &(local_params[0]), crStateHlpComponentsCount(pname)*sizeof (GLfloat) );
     178    size_t cComponents = RT_MIN(crStateHlpComponentsCount(pname), RT_ELEMENTS(local_params));
     179    crServerReturnValue( &(local_params[0]), cComponents*sizeof (GLfloat) );
    179180}
    180181
     
    188189        crStateGetTexEnviv( target, pname, local_params );
    189190
    190     crServerReturnValue( &(local_params[0]), crStateHlpComponentsCount(pname)*sizeof (GLint) );
     191    size_t cComponents = RT_MIN(crStateHlpComponentsCount(pname), RT_ELEMENTS(local_params));
     192    crServerReturnValue( &(local_params[0]), cComponents*sizeof (GLint) );
    191193}
    192194
Note: See TracChangeset for help on using the changeset viewer.

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