Open
Conversation
added 11 commits
August 7, 2020 17:39
yoavweiss
reviewed
Aug 12, 2020
yoavweiss
reviewed
Aug 12, 2020
yoavweiss
left a comment
There was a problem hiding this comment.
A few comments that seem to coalesce to a few categories:
- Style nits
- Out-of-bound checks - you need to make sure that all your array reads and writes are done within bounds, even if e.g. the input to the program is invalid (e.g. an attacker sends a corrupted brotli file), or, to a lesser extent, if the input to a function is invalid (e.g. a future programmer calls it with the wrong values). The former case needs to be handled gracefully, without crashing. The latter case, needs to be assert() against, at the very least. If this requires work that goes beyond the prototype's scope, leave a TODO to make sure this happens before the code's productization.
- Magic numbers - they make it hard to read the code and understand what it means. Constants with descriptive names are better
- Prototype-level shortcuts - No need to fix those IMO, but you do need to call them out (e.g. overly large allocations)
Also, I see a bunch of allocations but no free() to go along with them...
eustas
reviewed
Aug 13, 2020
ahorek
reviewed
Aug 29, 2020
| const uint8_t* word = &words->data[offset]; | ||
| const BrotliTransforms* transforms = BrotliGetTransforms(); | ||
| /* String can be sometimes longer then copy_len */ | ||
| uint8_t* string = (uint8_t*)malloc(sizeof(uint8_t) * copy_len * EXCEED_COPY_LEN_RATE); |
Contributor
There was a problem hiding this comment.
to avoid warnings, you should add
#include <stdlib.h>
at the top of the file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Faster and more efficient recompression using previous compression artifacts such as backward references and block splits.