Fixed #23638 -- Prevented crash while parsing invalid cookie content

Thanks Philip Gatt for the report and Tim Graham for the review.