In the Middle Ages there were a number of punishments that the people of a town or village could do to try to stop others from being a nuisance. People were put in the marketplace and fastened into a pair of boards on a frame. If the person stood up, that was a pillory, but if they sat down, it was the stocks.
When someone was put in the stocks it might be for the whole day. During that time people could throw what they liked at the person to be punished. Often it was rotting vegetables and poop. Sometimes it was buckets of wee. But if the person was really disliked, it could be stones. In that case a person might even be killed.