-
Notifications
You must be signed in to change notification settings - Fork 18k
x/net/html: render function segfaults instead of returning an error #30125
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
Comments
The same behaviour occurs, if I try to render a malformed tree of nodes. |
I think this could be easily fixed by checking if the pointer is |
Change https://golang.org/cl/161637 mentions this issue: |
I don't see an issue here. A panic when you pass nil to a function expecting a pointer is business as usual. The standard library also does this all over the place. If a nil pointer can be passed (e.g., a |
Well, yes and no, depending on the assessment; not simple nillable vs. non-nillable, perhaps from the system fault tolerance point of view. |
@dj95 Could you give an example of a such malformed tree please? |
@dj95, a minimal code example is the perfect bug report! However, the example is perhaps too contrived. How did you end up with a nil node in the first place? |
As @antong notes, Go packages conventionally do not check explicitly for |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I put invalid nodes into the render function in order to test if my error handling is correct.
E.g. with the following code:
a segfault occurs instead of a returned error.
What did you expect to see?
I expect to see an error returned by the render function
What did you see instead?
The program crashes with a segmentation fault.
The text was updated successfully, but these errors were encountered: