The bug
Jack'o'lanterns can be enchanted with curses, which doesn't make too much sense, as they cannot be equipped as a helmet.
To reproduce
Place an anvil
Get a jack'o'lantern
Get a "Curse of Binding" or "Curse of Vanishing" enchanted book
Switch into Survival mode
Try to combine the jack'o'lantern with either of these books
→ ❌ That is possible
Able to reproduce this