[pcre-dev] pcre_exec() with out-of-bounds offset

Top Page
Delete this message
Author: Ralf Junker
Date:  
To: pcre-dev
Subject: [pcre-dev] pcre_exec() with out-of-bounds offset
pcre_exec() returns strange values if I pass an offset greater than the
length of the subject string.

For the pattern

.*

and the subject string

abc

pcre_exec() with offset = 10 returns 1. Plus, it sets ovector to these
values:

ovector[1] = 9
ovector[2] = -2147483640
ovector[3] = -2139062144
ovector[4] = -2139062144
... and so on ...

This indicates to me that some of the ovector elements are not
initialized. If this intended?

I also wonder if pcre_exec() should indeed match above pattern and the
out-of-bounds offset. By common sense I would expect it to fail. Any
thoughts?

Ralf