Solution of the generalized Riemann problem for advection-reaction equations