godoc: proper index range checking when extracting example code
godoc: proper index range checking when extracting example code

Fixes issue 3092.

R=golang-dev, rsc
CC=golang-dev
http://codereview.appspot.com/5683075

wesolows/golang-old,firebitsbr/golang-old,wesolows/golang-old,wesolows/golang,firebitsbr/golang-old,wesolows/golang-old,wesolows/golang,wesolows/golang-old,wesolows/golang-old,wesolows/golang,firebitsbr/golang-old,wesolows/golang-old,firebitsbr/golang-old,wesolows/golang,firebitsbr/golang-old,firebitsbr/golang-old,firebitsbr/golang-old,wesolows/golang,wesolows/golang-old,wesolows/golang,firebitsbr/golang-old,wesolows/golang