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

Fails clap-validator test #38

Open
Username256 opened this issue Nov 21, 2023 · 3 comments
Open

Fails clap-validator test #38

Username256 opened this issue Nov 21, 2023 · 3 comments

Comments

@Username256
Copy link

The demo fails the clap-validator test.

I added this snippet to stateLoad
if (totalRd == 0) return false;

After this loop. Not sure it is a correct fix but it makes the clap-validator succeed. The reason it failed is because you must return false if an empty state is passed, so that might mean you also need to clear existing settings or something. Not sure? Just testing...

Thanks for making this demo. Makes it real easy to understand and implement clap.
buffer[0] = 0;
while ((rd = stream->read(stream, bp, chunkSize)) > 0)
{
bp += rd;
totalRd += rd;
if (totalRd >= maxSize - chunkSize - 1)
{
_DBGCOUT << "Invalid stream: Why did you send me so many bytes!" << std::endl;
// What the heck? You sdent me more than 32kb of data for a 700 byte string?
// That means my next chunk read will blow out memory so....
return false;
}
}
if (totalRd == 0) return false;

@baconpaul
Copy link
Collaborator

Oh this was written well before the validator and i never bothered to run it! Funny.

That change looks correct to me. Would you like to send a PR?

Thanks so much.

@Username256
Copy link
Author

Username256 commented Nov 21, 2023 via email

@baconpaul
Copy link
Collaborator

PR == "pull request" - how you send a change when collaborating on GitHub

But no worries - if you haven't done it I can add the fix also! Just it will then have my authorship not yours (which is fine)

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