VirtualBox

Changeset 82718 in vbox


Ignore:
Timestamp:
Jan 10, 2020 4:25:50 PM (5 years ago)
Author:
vboxsync
Message:

3D: Check last shader bytecode token, bugref:9613

Location:
trunk/src/VBox/Devices/Graphics
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp

    r82609 r82718  
    69086908    {
    69096909    case SVGA3D_SHADERTYPE_VS:
    6910         rc = ShaderCreateVertexShader(pContext->pShaderContext, (const uint32_t *)pShaderData, &pShader->u.pVertexShader);
     6910        rc = ShaderCreateVertexShader(pContext->pShaderContext, (const uint32_t *)pShaderData, cbData, &pShader->u.pVertexShader);
    69116911        AssertRC(rc);
    69126912        break;
    69136913
    69146914    case SVGA3D_SHADERTYPE_PS:
    6915         rc = ShaderCreatePixelShader(pContext->pShaderContext, (const uint32_t *)pShaderData, &pShader->u.pPixelShader);
     6915        rc = ShaderCreatePixelShader(pContext->pShaderContext, (const uint32_t *)pShaderData, cbData, &pShader->u.pPixelShader);
    69166916        AssertRC(rc);
    69176917        break;
  • trunk/src/VBox/Devices/Graphics/shaderlib/shader.c

    r82711 r82718  
    15681568    }
    15691569    shader->baseShader.frontend = fe;
    1570     shader->baseShader.frontend_data = fe->shader_init(byte_code, output_signature);
     1570    shader->baseShader.frontend_data = fe->shader_init(byte_code, shader->baseShader.functionLength / 4, output_signature);
    15711571    if (!shader->baseShader.frontend_data)
    15721572    {
  • trunk/src/VBox/Devices/Graphics/shaderlib/shader_sm1.c

    r62948 r82718  
    213213{
    214214    struct wined3d_shader_version shader_version;
     215    const DWORD *end;
    215216    const struct wined3d_sm1_opcode_info *opcode_table;
    216217};
     
    518519}
    519520
    520 static void *shader_sm1_init(const DWORD *byte_code, const struct wined3d_shader_signature *output_signature)
     521static void *shader_sm1_init(const DWORD *byte_code, DWORD tokens_num, const struct wined3d_shader_signature *output_signature)
    521522{
    522523    struct wined3d_sm1_data *priv;
     
    537538        return NULL;
    538539    }
     540   
     541    priv->end = byte_code + tokens_num;
    539542
    540543    if (output_signature)
     
    674677static BOOL shader_sm1_is_end(void *data, const DWORD **ptr)
    675678{
     679    struct wined3d_sm1_data *priv = data;
     680
     681    if (*ptr >= priv->end)
     682    {
     683        return TRUE;
     684    }
     685
    676686    if (**ptr == WINED3DSP_END)
    677687    {
  • trunk/src/VBox/Devices/Graphics/shaderlib/shader_sm4.c

    r53201 r82718  
    229229}
    230230
    231 static void *shader_sm4_init(const DWORD *byte_code, const struct wined3d_shader_signature *output_signature)
     231static void *shader_sm4_init(const DWORD *byte_code, DWORD tokens_num, const struct wined3d_shader_signature *output_signature)
    232232{
    233233    struct wined3d_sm4_data *priv = HeapAlloc(GetProcessHeap(), 0, sizeof(*priv));
     
    238238    }
    239239
     240    priv->end = byte_code + tokens_num;
    240241    priv->output_signature = output_signature;
    241242
     
    425426{
    426427    struct wined3d_sm4_data *priv = data;
    427     return *ptr == priv->end;
     428    return *ptr >= priv->end;
    428429}
    429430
  • trunk/src/VBox/Devices/Graphics/shaderlib/shaderapi.c

    r81981 r82718  
    314314}
    315315
    316 SHADERDECL(int) ShaderCreateVertexShader(void *pShaderContext, const uint32_t *pShaderData, void **pShaderObj)
     316SHADERDECL(int) ShaderCreateVertexShader(void *pShaderContext, const uint32_t *pShaderData, uint32_t cbShaderData, void **pShaderObj)
    317317{
    318318    IWineD3DDeviceImpl *This;
     
    329329        return VERR_NO_MEMORY;
    330330    }
     331
     332    object->baseShader.functionLength = cbShaderData;
    331333
    332334    hr = vertexshader_init(object, This, (DWORD const *)pShaderData, NULL, NULL, NULL);
     
    356358}
    357359
    358 SHADERDECL(int) ShaderCreatePixelShader(void *pShaderContext, const uint32_t *pShaderData, void **pShaderObj)
     360SHADERDECL(int) ShaderCreatePixelShader(void *pShaderContext, const uint32_t *pShaderData, uint32_t cbShaderData, void **pShaderObj)
    359361{
    360362    IWineD3DDeviceImpl *This;
     
    371373        return VERR_NO_MEMORY;
    372374    }
     375
     376    object->baseShader.functionLength = cbShaderData;
    373377
    374378    hr = pixelshader_init(object, This, (DWORD const *)pShaderData, NULL, NULL, NULL);
  • trunk/src/VBox/Devices/Graphics/shaderlib/shaderlib.h

    r76565 r82718  
    7272SHADERDECL(int) ShaderContextDestroy(void *pShaderContext);
    7373
    74 SHADERDECL(int) ShaderCreateVertexShader(void *pShaderContext, const uint32_t *pShaderData, void **pShaderObj);
    75 SHADERDECL(int) ShaderCreatePixelShader(void *pShaderContext, const uint32_t *pShaderData, void **pShaderObj);
     74SHADERDECL(int) ShaderCreateVertexShader(void *pShaderContext, const uint32_t *pShaderData, uint32_t cbShaderData, void **pShaderObj);
     75SHADERDECL(int) ShaderCreatePixelShader(void *pShaderContext, const uint32_t *pShaderData, uint32_t cbShaderData, void **pShaderObj);
    7676
    7777SHADERDECL(int) ShaderDestroyVertexShader(void *pShaderContext, void *pShaderObj);
  • trunk/src/VBox/Devices/Graphics/shaderlib/wined3d_private.h

    r82704 r82718  
    676676struct wined3d_shader_frontend
    677677{
    678     void *(*shader_init)(const DWORD *ptr, const struct wined3d_shader_signature *output_signature);
     678    void *(*shader_init)(const DWORD *ptr, DWORD tokens_num, const struct wined3d_shader_signature *output_signature);
    679679    void (*shader_free)(void *data);
    680680    void (*shader_read_header)(void *data, const DWORD **ptr, struct wined3d_shader_version *shader_version);
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