2,290. Worms in Fruit

Maachalos Assuros 2:15

The previous halacha (about worms in fruit) applies when the food became wormy after being detached from the ground. If it became wormy while still connected, the worm is prohibited as if it left the fruit for the ground because it was created on the ground. One who eats it is liable for lashes. In a case of doubt, it is prohibited. Accordingly, all fruits that typically get wormy while still connected may not be eaten until one checks for worms inside the fruit. If fruit goes 12 months from being detached, it may be eaten without being checked because a worm won’t last 12 months inside it.

Maachalos Assuros 2:16

If a worm leaves the fruit for the air but it doesn’t reach the ground, if only part of it reached the ground, if it left the fruit after it died, if the worm was found on a seed on the inside, or if the worm went from one food to another – in all these cases, it’s prohibited out of doubt but one would not receive lashes.