Measurement of the W+W- and ZZ production cross sections in pp collisions at sqrt(s) = 8 TeV