Message 339465 - Python tracker

Message339465

Author eryksun
Recipients ZackerySpytz, eryksun, steve.dower, stutzbach, tim.golden, zach.ware
Date 2019-04-04.21:46:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1554414411.15.0.182176918252.issue9194@roundup.psfhosted.org>
In-reply-to
Content
There's still a potential problem when Reg2Py calls wcslen(str[index]). This could be addressed by having fixupMultiSZ take an int array to store the length of each string. For example:

    static void
    fixupMultiSZ(wchar_t **strings, int *lengths, wchar_t *data, int len)
    {
        wchar_t *P, *Q = data + len;
        int i;

        for (P = data, i = 0; P < Q && *P; P++, i++) {
            strings[i] = P;
            lengths[i] = 0;
            for (; P < Q && *P; P++) {
                lengths[i]++;
            }
        }
    }

We'd have to allocate the lengths array in Reg2Py, like we do for the strings array. Also, we can remove the overflow error check prior to PyUnicode_FromWideChar. The longest possible length is `retDataSize / 2`, which occurs if a single string is stored without any null terminators.
History
Date User Action Args
2019-04-04 21:46:51eryksunsetrecipients: + eryksun, tim.golden, stutzbach, zach.ware, steve.dower, ZackerySpytz
2019-04-04 21:46:51eryksunsetmessageid: <1554414411.15.0.182176918252.issue9194@roundup.psfhosted.org>
2019-04-04 21:46:51eryksunlinkissue9194 messages
2019-04-04 21:46:51eryksuncreate