dashboard/app: fix 2 crashes on invalud input data

This commit is contained in:
Dmitry Vyukov 2018-03-07 13:01:50 +01:00
parent 11cf581658
commit 299c167882
2 changed files with 4 additions and 3 deletions

View File

@ -61,7 +61,7 @@ func checkCrashTextAccess(c context.Context, r *http.Request, field string, id i
return fmt.Errorf("failed to query crashes: %v", err)
}
if len(crashes) != 1 {
fmt.Errorf("checkCrashTextAccess: found %v crashes for %v=%v",
return fmt.Errorf("checkCrashTextAccess: found %v crashes for %v=%v",
len(crashes), field, id)
}
bug := new(Bug)

View File

@ -257,8 +257,9 @@ func handleBug(c context.Context, w http.ResponseWriter, r *http.Request) error
func handleText(c context.Context, w http.ResponseWriter, r *http.Request) error {
tag := r.FormValue("tag")
id, err := strconv.ParseInt(r.FormValue("id"), 10, 64)
if err != nil {
return fmt.Errorf("failed to parse text id: %v", err)
if err != nil || id == 0 {
log.Infof(c, "failed to parse text id: %v", err)
return nil
}
if err := checkTextAccess(c, r, tag, id); err != nil {
return err