utrack / clay

Proto-first minimal server platform for gRPС+REST+Swagger APIs
MIT License
289 stars 39 forks source link

Unmarshal panic #70

Closed NOMORECOFFEE closed 5 years ago

NOMORECOFFEE commented 5 years ago

https://github.com/utrack/clay/blob/master/transport/httpruntime/mjson.go#L41 it's not correct logical operator && for v = v.Elem() invoked here

https://golang.org/pkg/reflect/#Value.Elem It panics if v's Kind is not Interface OR Ptr.

I think it should be ||

utrack commented 5 years ago

Why? Elem panics if it's not an interface or a pointer; we break the loop if v is neither an interface nor a pointer. Looks right to me.

OR wouldn't break the loop only if v's kind isn't a ptr and an interface at the same time.

NOMORECOFFEE commented 5 years ago

@utrack you are right. Sorry for issue