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 panic caused by invalid ip range #10204

Merged

Conversation

xiangpengzhao
Copy link
Contributor

If an invalid ip range such as 1.2.3-4 is passed to ipfailover, it will lead to a panic. I produce the panic in unit test by adding an invalid ip range in test cases. I haven't produced it on real env yet, but I think it will have the same behavior.

--- FAIL: TestValidateIPAddressRange (0.00s)
panic: runtime error: index out of range [recovered]
    panic: runtime error: index out of range

goroutine 15 [running]:
panic(0x1740000, 0xc82000e070)
    /usr/local/go/src/runtime/panic.go:464 +0x3ff
testing.tRunner.func1(0xc8203d61b0)
    /usr/local/go/src/testing/testing.go:467 +0x22a
panic(0x1740000, 0xc82000e070)
    /usr/local/go/src/runtime/panic.go:426 +0x521
github.com/openshift/origin/pkg/ipfailover.ValidateIPAddressRange(0x1934438, 0x7, 0x0, 0x0)
    github.com/openshift/origin/pkg/ipfailover/_test/_obj_test/validator.go:38 +0x1064
github.com/openshift/origin/pkg/ipfailover.TestValidateIPAddressRange(0xc8203d61b0)
    /root/go/src/github.com/openshift/origin/_output/local/go/src/github.com/openshift/origin/pkg/ipfailover/validator_test.go:49 +0x426
testing.tRunner(0xc8203d61b0, 0x24970d8)
    /usr/local/go/src/testing/testing.go:473 +0xdd
created by testing.RunTests
    /usr/local/go/src/testing/testing.go:582 +0xae3
FAIL    github.com/openshift/origin/pkg/ipfailover  0.079s
[ERROR] PID 26569: hack/test-go.sh:299: `go test ${gotest_flags} ${test_packages}` exited with status 1.
[INFO]      Stack Trace: 
[INFO]        1: hack/test-go.sh:299: `go test ${gotest_flags} ${test_packages}`
[INFO]   Exiting with code 1.
hack/test-go.sh failed after 56 seconds

Also add a validation for invalid format of ip range such as 1.2.3.4-5-6.

Maybe we can make more cleanup for func ValidateIPAddressRange

@mfojtik
Copy link
Contributor

mfojtik commented Aug 4, 2016

LGTM [merge]

@xiangpengzhao
Copy link
Contributor Author

Test failed due to #9195 . @mfojtik Please help to request a re-test, thanks!

@stevekuznetsov
Copy link
Contributor

@openshift-bot, the last build failed from the following flakes:

re[merge]

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to 88ee27c

@openshift-bot
Copy link
Contributor

openshift-bot commented Aug 5, 2016

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/7546/) (Image: devenv-rhel7_4764)

@openshift-bot openshift-bot merged commit 43afc51 into openshift:master Aug 5, 2016
@xiangpengzhao xiangpengzhao deleted the fix-ipfaileover-checkip branch October 19, 2016 07:24
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.

4 participants