Usually it is just sucked into the air intake on four cycle engines. There are intake vents and flame arrestors to prevent ignition within the crankcase. In automobile and truck engines this may be accomplished by a filter within the filtered air intake stream and a PCV valve to prevent back flow and explosion. Stationary engines do it several different ways from just venting to atmosphere to similar to automotive engines.
On 2 cycle engines it is normally a self limiting problem.
__________________
If the software can detect, compensate, avoid, or correct an anomalous condition in the system, it is, by definition, a software problem-regardless of the root cause. In the long run, for most classes of problems, it is cheaper to fix it in the SW