Add negative bounds checks for string_head and string_tail

(cherry picked from commit d4560179b5d3c301e9ef501948f6f110deeaac0d)
Fail when read_file is called with a negative size

(cherry picked from commit 3d41d8dcbdeb4d75fba5ba8e3ccf3243fbc5885a)
readfile and textxform functions do not rely on 4k limit anymore

(cherry picked from commit 308ca23030566030edf0d17f73c34c2f4f6856eb)
Added text_xform tests for large sizes

(cherry picked from commit ace639a82c99bc984de556a0a627f2b2804ddac7)
CF_INFINITY is not a limit for buffer size, it's just an indication that policy has the parameter 'inf'.

(cherry picked from commit 616c51993547a178b258bcc4143948d5293f4e04)
Comment for clarity.

(cherry picked from commit 2b7e9d3bae469d842cf5f349207fbf5a05c53689)