It might be worth familiarizing yourself with the Dirac Delta distribution, as it's the canonical example of this sort of behavior. For instance, imagine a random variable $f$ (over $\mathbb{R}$, not just $\mathbb{Z}$ or $\{0,1\}$) that's $0$ with probability $\frac12$ and $1$ with probability $\frac12$. Then the CDF $F(x)$ will be $0$ for $x\lt 0$, $\frac12$ for $0\leq x\lt 1$, and $1$ for $1\leq x$. Looking at the distribution, there will be infinite spikes at both $0$ and $1$; the pdf will be a sum $\frac12\delta(x,0)+\frac12\delta(x,1)$ (note that the normalization here is necessary to make sure that the cumulative is a proper CDF!).
The key is that a probability density function will 'be infinite' anywhere the cumulative distribution has a jump discontinuity - but that jump discontinuity doesn't need to go from $0$ to $1$; it doesn't even need to be discrete, as the variable could be continuous on either side of the jump cut. It does imply that there's a finite probability that the variable takes on whatever value the jump cut occurs at, though.