There is a myth sadly still doing the rounds (for example you will find Alison Weir stating in her biography of Eleanor of Aquitaine on the section about medieval life. 'Stuffings, marinades and rich sauces often flavoured with garlic were used to disguise the taste and smell of rancid meat which had in many cases gone green) that spices were used to cover up the taint of meat that had gone off or to preserve the meat. Why, if you could afford the highly expensive ingredients for said stuffings, marinades and rich sauces, you would then want to squander them on tainted meat isn't explained. And if you had to eat tainted meat because you would starve if you didn't, you certainly weren't in a position to be able to afford the cost of the spices.
Professor Paul Freedman in Out of the East: Spices and the Medieval Imagination says 'This compelling but false idea constitutes something of an urban legend, a story so instinctively attractive that mere fact seems unable to wipe it out.' He goes on to say that spices are pretty useless for preserving food when compared to methods such as pickling, smoking and drying, and that they won't do much to mask the taste of bad meat anyway, only compound it.
Professor Terence Scully in The Art of Cookery in the Middle Ages says rather optimistically given the Weir statement: 'With our increased knowledge about medieval cookery it is no longer necessary to refute that tired old, utterly groundless statement that spices were used to mask the flavour of spoiled meat. The kitchens of late medieval European potentates had absolutely no reason to handle tainted meat in the first place...nor would the potentates themselves, who had reason to pride themselves on a certain gastronomic sensitivity, have tolerated being presented with dishes whose objectional base taste was compounded by the adjunction of seasonings that were even stronger.'
Although there was no refrigeration in the Middle Ages, meat didn't tend to hang around for any length of time. It was slaughtered on site and sold on site, and purchasers had noses to detect what they were getting. And if they bought spoiled meat for a bargain price at the end of the day, they weren't the sort of people who were going to be able to afford to buy spices anyway!
In the early 14th century, a pig cost the same price as a pound of pepper, which was the cheapest spice. John Munro, an economics historian at the University of Toronto calculated the price of spices in England in 1439 and used a skilled craftsman's wages of that date as a yardstick.
The craftsman earned 8 pence a day. One penny bought him a gallon of milk, a pint of butter of lard, or quarter bushel of coal.
7 yards of good quality wool cloth would cost him 7 shillings, about 10 days' wages, but the same quantity of velvet would cost him between 200 and 300 days' wages. (note, only put your highest status characters in velvet if writing about this period!). A pound of sugar cost 16pence, so equivalent to 2 days' wages. Pepper cost slightly more and ginger slightly less. A pound of cloves would cost four and a half days' wages and the same of cinnamon 3 days'. He would have to work for a month to earn enough to buy a pound of saffron.
So there you have it. If you find a historian saying that people disguised their tainted food with spices, take it with a large pinch of salt!