Consultor Eletrônico



Kbase P126671: Can't PUT past the end of the MEMPTR. (4791) when using LENGTH(variable, "CHARACTER") function
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/30/2007
Status: Unverified

SYMPTOM(s):

Can't PUT past the end of the MEMPTR. (4791)

Application uses LENGTH(string-var, "CHARACTER") to determine length of a string.

String string-var contains non-printable (invisible) multi-byte characters.

Result of LENGTH(string-var, "CHARACTER") is used to set the size of a MEMPTR variable to hold a string:

SET-SIZE(memptr-var) = LENGTH(string-var, "CHARACTER") + 1.

Assigning the string string-var to the MEMPTR variable results in system error 4791:

PUT-STRING(memptr-var,1) = string-var.

CAUSE:

LENGTH(string-var, "CHARACTER") will return length in characters, including double-byte characters.

FIX:

Use LENGTH(string-var, "RAW") to express the length of the variable in bytes or ensure that string-var does not contain double-byte characters.