[PATCH] Fix out-of-bouds access (src/common/wchar.c) - Mailing list pgsql-hackers

From Ranier Vilela
Subject [PATCH] Fix out-of-bouds access (src/common/wchar.c)
Date
Msg-id CAEudQAoxS13snR7+o23300srfQ6hH+utRVYSWfZ8qTmd5SLmEQ@mail.gmail.com
Whole thread Raw
Responses Re: [PATCH] Fix out-of-bouds access (src/common/wchar.c)
List pgsql-hackers
Hi,

Per Coverity.

Like the function pg_encoding_max_length_sql (src/backend/utils/mb/mbutils.c)
Only assertion is insufficient to avoid accessing array out-of-bounds.

This bug is live according Coverity at function: pg_verify_mbstr_len (src/backend/utils/mb/mbutils.c)
CID 1469870 (#1 of 1): Out-of-bounds access (OVERRUN)7. overrun-call: Overrunning callee's array of size 42 by passing argument src_encoding (which evaluates to 63) in call to pg_verify_mbstr_len. [show details]
633        retval = pg_verify_mbstr_len(src_encodingsrc_strlenfalse);
634

Trivial patch attached.

regards,

Ranier Vilela

Attachment

pgsql-hackers by date:

Previous
From: Nitin Jadhav
Date:
Subject: Re: Report checkpoint progress with pg_stat_progress_checkpoint (was: Report checkpoint progress in server logs)
Next
From: Dave Page
Date:
Subject: Re: Observability in Postgres