Skip to content

Commit

Permalink
fix: 🔧 unicode is rendered weirdly
Browse files Browse the repository at this point in the history
  • Loading branch information
fungiboletus committed Sep 24, 2024
1 parent 0d55c65 commit 822f5a1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions docs/blog-post.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Loading the 1234th bit:

|154th byte: |0|1|2|3|4|5|6|7|
|-|-|-|-|-|-|-|-|-|
||||||||||
||b|b|b|b|b|b|b|b|
||||||||||

In Python, using the rarely used bitwise operators:
Expand Down Expand Up @@ -123,18 +123,18 @@ Examples of padding `0` bits at the end of the last octet:

|0|1|2|3|4|5|6|7|
|-|-|-|-|-|-|-|-|
||||||`0`|`0`|`0`|
|||`0`|`0`|`0`|`0`|`0`|`0`|
|||||||||
||||||||`0`|
|b|b|b|b|b|`0`|`0`|`0`|
|b|b|`0`|`0`|`0`|`0`|`0`|`0`|
|b|b|b|b|b|b|b|b|
|b|b|b|b|b|b|b|`0`|

## The Bug

Once in a while, the padding bit size of a Prometheus XOR chunk was 8 bits. Even though the data chunk was already aligned to 8 bits, Prometheus added an extra byte of 8 zero bits at the end of the data block.

|0|1|2|3|4|5|6|7|.|0|1|2|3|4|5|6|7|
|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|
|||||||||.|`0`|`0`|`0`|`0`|`0`|`0`|`0`|`0`|
|b|b|b|b|b|b|b|b|.|`0`|`0`|`0`|`0`|`0`|`0`|`0`|`0`|

I discovered it because I had an assertion in my parsing code to ensure the padding size was between 0 and 7 bits long. Prometheus' parser ignores the padding and doesn't check its size, so no one noticed the bug until now. The bug wasn't always happening, but it wasn't rare either.

Expand Down

0 comments on commit 822f5a1

Please sign in to comment.