You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2020/12/29 16:26:19 UTC
[GitHub] [dubbo-go-hessian2] lujjjh opened a new issue #253: String encoding and decoding
lujjjh opened a new issue #253:
URL: https://github.com/apache/dubbo-go-hessian2/issues/253
There are 2 known issues in string encoding and decoding.
The first one is an out-of-range problem that the code below doesn't handle edge cases well:
https://github.com/apache/dubbo-go-hessian2/blob/e2494da763e751f939d824ddf70482a086d460c6/string.go#L164
The inner loop
https://github.com/apache/dubbo-go-hessian2/blob/e2494da763e751f939d824ddf70482a086d460c6/string.go#L176
could actually exit with `charCount > CHUNK_SIZE` (or more precisely, `charCount == CHUNK_SIZE + 1`). The maximum bytes taken could be `(CHUNK_SIZE + 1) * 3`.
A simple reproducible test case:
```go
func TestEncStringChunk(t *testing.T) {
enc := NewEncoder()
v := strings.Repeat("ć", CHUNK_SIZE-1) + "đ¤Ł"
assert.Nil(t, enc.Encode(v))
dec := NewDecoder(enc.Buffer())
s, err := dec.Decode()
assert.Nil(t, err)
assert.Equal(t, v, s)
}
```
After a quick fix with
```go
bufp := gxbytes.AcquireBytes((CHUNK_SIZE + 1) * 3)
```
I encountered the second issue with the same test case above:
> Error: Not equal:
> expected: "ćććâŚâŚćđ¤Ł"
> actual : "ćććâŚâŚćđ¤Ł\x00\x00"
After bisection, I assume this was introduced in dea11741cdda0a8e783699522ea97c2a1a005295 because the same test could be passed if I apply the quick fix on 8dcaa2043564888bf8d4f294b51946a372f12b75, which is the parent of dea11741cdda0a8e783699522ea97c2a1a005295.
I haven't dived into the commit yet since it's a bit complicated.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go-hessian2] wongoo commented on issue #253: String encoding and decoding
Posted by GitBox <gi...@apache.org>.
wongoo commented on issue #253:
URL: https://github.com/apache/dubbo-go-hessian2/issues/253#issuecomment-753562485
the current chunk string decoding algorithm is complex, and hard to maintain. I will try to refactor it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go-hessian2] AlexStocks commented on issue #253: String encoding and decoding
Posted by GitBox <gi...@apache.org>.
AlexStocks commented on issue #253:
URL: https://github.com/apache/dubbo-go-hessian2/issues/253#issuecomment-752163571
@wongoo we have met such problems in my memory. It is not so easy to fix this problem.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go-hessian2] lujjjh commented on issue #253: String encoding and decoding
Posted by GitBox <gi...@apache.org>.
lujjjh commented on issue #253:
URL: https://github.com/apache/dubbo-go-hessian2/issues/253#issuecomment-757331241
#254 does not actually fix this case. I've created a pull request.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go-hessian2] wongoo commented on issue #253: String encoding and decoding
Posted by GitBox <gi...@apache.org>.
wongoo commented on issue #253:
URL: https://github.com/apache/dubbo-go-hessian2/issues/253#issuecomment-752286389
@zonghaishang pls check this issue, I will also go into sometime later
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go-hessian2] lujjjh commented on issue #253: String encoding and decoding
Posted by GitBox <gi...@apache.org>.
lujjjh commented on issue #253:
URL: https://github.com/apache/dubbo-go-hessian2/issues/253#issuecomment-757331241
#254 does not actually fix this case. I've created a pull request.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go-hessian2] wongoo closed issue #253: String encoding and decoding
Posted by GitBox <gi...@apache.org>.
wongoo closed issue #253:
URL: https://github.com/apache/dubbo-go-hessian2/issues/253
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go-hessian2] wongoo commented on issue #253: String encoding and decoding
Posted by GitBox <gi...@apache.org>.
wongoo commented on issue #253:
URL: https://github.com/apache/dubbo-go-hessian2/issues/253#issuecomment-754988530
it's fixed in https://github.com/apache/dubbo-go-hessian2/releases/tag/v1.8.1
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go-hessian2] wongoo commented on issue #253: String encoding and decoding
Posted by GitBox <gi...@apache.org>.
wongoo commented on issue #253:
URL: https://github.com/apache/dubbo-go-hessian2/issues/253#issuecomment-752802012
ref: https://github.com/apache/dubbo-go-hessian2/issues/252
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org