-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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 points write panic #4591
fix points write panic #4591
Conversation
pull from remote master
@oiooj -- can you please run the test suite locally before pushing up any further commits? That way you will get the quickest turnaround when debugging your code. |
@otoolep sure, I have ran the test file. $ go test points_test.go
ok command-line-arguments 0.013s
$ go test handler_test.go
ok command-line-arguments 0.019s
It is right ? |
I don't know, depends if you are in the correct directory.
will run the test that is failing on Circle. |
No problem here, I don't know what's going on. Always failed on Circle. Sosara@MBA:~/golang/src/github.com/oiooj/influxdb/models$ go test -run TestParsePointNoValue
PASS
ok github.com/oiooj/influxdb/models 0.010s and the circle-test.sh ...
--- PASS: TestWAL_Cursor_Reverse (0.00s)
PASS
ok github.com/influxdb/influxdb/tsdb/engine/wal 0.949s
? github.com/influxdb/influxdb/tsdb/internal [no test files]
? github.com/influxdb/influxdb/uuid [no test files] bash circle-test.sh returned exit code 1
|
@otoolep fixed , Thanks |
Thanks @oiooj. Can you please rebase and squash the commits, with a single commit? |
Can you also add a test case for this? We really need test cases for every change. |
rebased the commits , I reviewed |
@@ -461,7 +461,7 @@ func (h *Handler) serveWriteLine(w http.ResponseWriter, r *http.Request, body [] | |||
} | |||
|
|||
// check that the byte is in the standard ascii code range | |||
if body[i] > 32 { | |||
if body[i] > 32 || i >= len(body)-1 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I see what you are doing. Basically, if it's not JSON by index (len-1) (and not a valid ASCII character either), it's not JSON at all. Is that what you're getting at?
I believe I follow what this patch fixes, but I'd like a second set of eyes. |
Yes this appears to make sense. We should add a test though so that we don't regress. Once a test is added, +1. Thanks! |
Closing in favour #4625 |
fix
index out of range
risk, log here: