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

Bit Overflow detection - process.stderr.write() shouldn't be used in browser #47

Open
nervetrip opened this issue Oct 21, 2024 · 0 comments

Comments

@nervetrip
Copy link

The following code throws an uncaught error in browser environments:

if (encodeLen > sizeOfBlocks) {
    process.stderr.write('bits overflow! try to shrink text or reduce copies.\n')
}

Here is the error:

stego.ts:49 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'write')
    at encodeImg (stego.ts:49:20)

The code is located in two places:

Can this code be refactored to throw an informative exception? This would allow web clients to detect and report more useful messaging to user when they attempt to encode more data than an image can hold.

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

1 participant