Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Divide by zero in compressed image subdata #83

Open
publicrepo opened this issue Aug 16, 2022 · 2 comments
Open

Divide by zero in compressed image subdata #83

publicrepo opened this issue Aug 16, 2022 · 2 comments

Comments

@publicrepo
Copy link

There can be a divide by zero on this line when numBlocksX is zero, which occurs for small / mip textures.

VkResult Device::CompressedImageSubData(Image* pImage, const VezImageSubDataInfo* pSubDataInfo, const void* pData)
    auto maxTransferBlocksY = std::min(numBlocksY, static_cast<uint32_t>(pinnedMemoryBufferSize / (blockSize * numBlocksX)));

This can be trivially fixed by checking for zero before divide. The code otherwise appears correct as it rounds up zero block counts to one for those tiny sizes.

@manhnt9
Copy link

manhnt9 commented Aug 17, 2022

Hi, could you contribute to this repo? V-EZ github is unmaintained for now.

@publicrepo
Copy link
Author

@manhnt9 Maybe. I'm just playing around with VEZ and reporting some issues I found here. I notice a few other forks of this repo have recent development and maintenance effort. I don't have a repo to share, just some code I'm playing with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants