Sugar and garlic should go bad after three or four years.
There are many acidophilic, halophilic and sugar-loving microorganisms in nature. This kind of microorganism can inhibit the growth of spoilage microorganisms during curing. But after a long time, the harmful substances produced by such microorganisms will accumulate to the extent of affecting health and even threatening life.
Therefore, if the preserved food is kept for more than the normal consumption period, don't eat it again.
References:
Baidu encyclopedia-sugar and garlic