In a large saucepan, bring the milk to a gentle boil. Reserve ¼ cup and set aside.
In another pan, add rice and two ladles of hot milk. Simmer slowly, stirring until absorbed.
Continue adding milk one ladle at a time, stirring constantly, until half the milk is absorbed.
Stir in sugar and let rice absorb most of the liquid.
Add the remaining milk gradually until rice is tender and creamy, about 35–40 minutes total.
Mix cornstarch with the reserved milk, then stir into pudding to thicken.
Add heavy cream, stir until combined, then remove from heat.
Stir in vanilla and optional mastic.
Transfer pudding into a baking dish and let it rest uncovered.
Preheat broiler and place dish underneath until the top develops golden brown spots, about 5 minutes.
Cool slightly before serving. Serve warm or chilled.