[ASTERIXDB-2442][FUN] substring() should return NULL if the operation cannot be performed

- user model changes: yes
- storage format changes: no
- interface changes: no

Details:
- substring() should return NULL if starting offset is out of bounds
  for given string or length is negative

(merge commit '42a739aba768357eb9f80f917f8967879bf44768' from stabilization-f69489)

Change-Id: Iedc34869feb91cd8015db36b61fee7e803e9ec1f