lib: Add better guard against huge malloc

See dda6857f
and https://bugzilla.redhat.com/show_bug.cgi?id=1656518

When the number of lines to assemble is 1, the median_filter() function
would be passed -1 as its size as it was calculated with:
(num_lines / 2) - 1
so (1 / 2) - 1 = 0 - 1 = -1

Add a guard to stop drivers trying to assemble single lines. This
doesn't however fix the vfs5011 driver that tried to do that.
2 jobs for master in 3 minutes and 37 seconds
Status Job ID Name Coverage
  Build
passed #57564
build

00:02:43

 
  Test
passed #57565
flatpak master

00:00:54