VirtualBox

Ignore:
Timestamp:
Oct 10, 2019 12:17:52 PM (5 years ago)
Author:
vboxsync
Message:

More validation of a shader bytecode, bugref:9520

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/shaderlib/shader.c

    r79670 r81211  
    335335}
    336336
    337 static void shader_record_register_usage(IWineD3DBaseShaderImpl *shader, struct shader_reg_maps *reg_maps,
     337static HRESULT shader_record_register_usage(IWineD3DBaseShaderImpl *shader, struct shader_reg_maps *reg_maps,
    338338        const struct wined3d_shader_register *reg, enum wined3d_shader_type shader_type)
    339339{
     
    365365                else
    366366                {
    367                     ((IWineD3DPixelShaderImpl *)shader)->input_reg_used[reg->idx] = TRUE;
     367                    unsigned int reg_idx = reg->idx;
     368                   
     369                    if (reg_idx >= MAX_REG_INPUT)
     370                    {
     371                        ERR("Invalid input register index %d.\n", reg_idx);
     372                        return E_INVALIDARG;
     373                    }
     374                   
     375                    ((IWineD3DPixelShaderImpl *)shader)->input_reg_used[reg_idx] = TRUE;
    368376                }
    369377            }
     
    421429            break;
    422430    }
     431
     432    return S_OK;
    423433}
    424434
     
    660670                struct wined3d_shader_src_param dst_rel_addr;
    661671                struct wined3d_shader_dst_param dst_param;
     672                HRESULT hr;
    662673
    663674                fe->shader_read_dst_param(fe_data, &ptr, &dst_param, &dst_rel_addr);
    664675
    665                 shader_record_register_usage(shader, reg_maps, &dst_param.reg, shader_version.type);
     676                hr = shader_record_register_usage(shader, reg_maps, &dst_param.reg, shader_version.type);
     677                if (FAILED(hr))
     678                {
     679                    ERR("shader_record_register_usage failed.\n");
     680                    return hr;
     681                }
    666682
    667683                /* WINED3DSPR_TEXCRDOUT is the same as WINED3DSPR_OUTPUT. _OUTPUT can be > MAX_REG_TEXCRD and
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