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

fix: In decodeUnicode, the case that the expected buffer's state is not satisfied after reading. #380

Merged
merged 2 commits into from Jul 9, 2022

Conversation

orisano
Copy link
Sponsor Contributor

@orisano orisano commented Jul 6, 2022

fix #374

io.MultiReaderなどを使うケースでReadをしてもio.EOFでなく要求したバイト数取得できないケースが存在する.
その際にfilledBufferがfalseになる. filledBufferがfalseの場合, bufferを拡張する処理が動かないため再利用の処理のみが実行される.
decodeUnicodeRuneの内部においてbufferが拡張される前提で書かれている処理があり, それが原因でpanicが発生していた.
新たに readAtLeast という関数を導入し, 期待するバッファーの状態を満たすようにした.

@codecov-commenter
Copy link

codecov-commenter commented Jul 6, 2022

Codecov Report

Merging #380 (79d8df0) into master (88aa13e) will increase coverage by 0.01%.
The diff coverage is 83.33%.

@@            Coverage Diff             @@
##           master     #380      +/-   ##
==========================================
+ Coverage   79.94%   79.95%   +0.01%     
==========================================
  Files          52       52              
  Lines       17578    17582       +4     
==========================================
+ Hits        14053    14058       +5     
+ Misses       2957     2955       -2     
- Partials      568      569       +1     

Copy link
Owner

@goccy goccy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for great PR ! LGTM !

@goccy goccy merged commit a812201 into goccy:master Jul 9, 2022
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

Successfully merging this pull request may close these issues.

Panic in decoder
3 participants