-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
x/text/language: index out of range #41617
Comments
Is this also reproducible with the current head commit ( |
Yeah. Here's a playground using the current head commit:
|
"t_pt_MLt" ends up being t-mt in scan.b for some reason and so s.b[4] is throwing index out of bound. I tried testing for other strings with similar pattern as given string but they were working fine. |
I'll work on this. |
I had some spare time so decided to take pick up a Go issue for the first time. But I am not terribly familiar with the Go source I agree with @darkLord19. Internally, the call to Later on, Again, I am not very familiar with this code (so please let me know if I am wrong), but I think there are a few issues here:
Anyways, please let me know if this is helpful and if you would like me to submit a patch to make the changes. I am aware that someone else already said that they are working on it... |
@andresag01 I'm currently a little bit busy, so you are absolutely welcome to contribute a patch for this issue. |
I have a patch that I can submit for this if no one else has submitted one yet. As @andresag01 mentioned, the relevant part is inside |
@hongrich: I do not have a patch and I won't work on it if you plan to submit yours. If it helps, I am happy to review your change once you've raised the PR |
Change https://golang.org/cl/260177 mentions this issue: |
The problem is that it should not do the |
parseTag tries to replace <lang>-<extlang> with <extlang>, but <extlang> itself can also be replaced with its canonical form which can be a different length than the original <extlang>. The existing implementation assumes that the length of <extlang> is 3 and would leave scanner positions in an incorrect state if the length of <extlang> is not 3. Fixes golang/go#41617 Change-Id: Ie0da320530e2545f9b521e7b8cf503d854c50b45 Reviewed-on: https://go-review.googlesource.com/c/text/+/260177 Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: Alberto Donizetti <alb.donizetti@gmail.com> Trust: Cherry Mui <cherryyz@google.com> Trust: Marcel van Lohuizen <mpvl@golang.org> Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
This following program on the latest stable release,
go1.14.8
andgolang.org/x/text@v0.3.3
:https://play.golang.org/p/0MCiLN3ojeZ
crashes as follows:
This is found with go-fuzz
The text was updated successfully, but these errors were encountered: