[issue15954] No error checking after using of the wcsxfrm()

2017-03-24 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset be487a65f18e1be5fde03e2977fff4be53cc2fbf by Serhiy Storchaka in 
branch 'master':
bpo-15954: Check return code of wcsxfrm(). (#508)
https://github.com/python/cpython/commit/be487a65f18e1be5fde03e2977fff4be53cc2fbf


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15954] No error checking after using of the wcsxfrm()

2017-03-06 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.7 -Python 3.4, Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15954] No error checking after using of the wcsxfrm()

2017-03-06 Thread Mark Lawrence

Changes by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15954] No error checking after using of the wcsxfrm()

2017-03-06 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +417

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15954] No error checking after using of the wcsxfrm()

2014-06-15 Thread Mark Lawrence

Mark Lawrence added the comment:

@Serhiy you don't need Windows, msg170593 refers to a Linux man page.  Reading 
your msg170595 I'd guess that you've got confused with a similar function that 
is Windows specific.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15954] No error checking after using of the wcsxfrm()

2014-06-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I have no Windows and can't provide relevant test case.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15954] No error checking after using of the wcsxfrm()

2014-06-15 Thread Mark Lawrence

Mark Lawrence added the comment:

@Serhiy will you follow up on this?

--
nosy: +BreamoreBoy
versions: +Python 3.4, Python 3.5 -Python 3.2, Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15954] No error checking after using of the wcsxfrm()

2012-09-24 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

What error message is most appropriate here?

Can we return the original string instead of exception?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15954] No error checking after using of the wcsxfrm()

2012-09-24 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> Dummy question: can you provide an example of strings that make wcsxfrm() 
> failing?

No, I can not (on Linux).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15954] No error checking after using of the wcsxfrm()

2012-09-24 Thread STINNER Victor

STINNER Victor added the comment:

Dummy question: can you provide an example of strings that make wcsxfrm() 
failing?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15954] No error checking after using of the wcsxfrm()

2012-09-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> No, I think the appropriate error is ValueError, at least if errno is EINVAL.

With what message?

> msvcrt gives EILSEQ or ERANGE, but never EINVAL. EILSEQ is returned if 
> LCMapString failed, and ERANE if the output buffer is too small.

I don't see where ERANE can be returned. If the output buffer is too small then 
the required buffer size (not including terminating null-char) should be 
returned.

I see the same issue with wcscoll() in locale.strcoll().

An alternative solution is in case of an error to return the original string 
(in locale.strxfrm) and to compare strings without regard locale (in 
locale.strcoll).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15954] No error checking after using of the wcsxfrm()

2012-09-18 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +haypo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15954] No error checking after using of the wcsxfrm()

2012-09-17 Thread Martin v . Löwis

Martin v. Löwis added the comment:

> I don't know what exception type should be used here: 
> OSError with an errno EINVAL or some specialized type. 

No, I think the appropriate error is ValueError, at least if errno is EINVAL.

> because I don't know under what conditions it would be possible error

AFAICT, glibc never sets errno. 

msvcrt gives EILSEQ or ERANGE, but never EINVAL. EILSEQ is returned if 
LCMapString failed, and ERANE if the output buffer is too small. In either 
case, the result is INT_MAX.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15954] No error checking after using of the wcsxfrm()

2012-09-17 Thread Christian Heimes

Christian Heimes added the comment:

The patch looks good. `s` and `buf` are cleaned up after the exit label.

--
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15954] No error checking after using of the wcsxfrm()

2012-09-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a sample patch (to specify the location of the issue). I don't sure 
OSError is well here.

As far as I understand, this function is Windows-specific, so I can't check how 
it works with code points beyond the BMP or with surrogates.

--
keywords: +patch
Added file: http://bugs.python.org/file27208/wcsxfrm_error_check.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15954] No error checking after using of the wcsxfrm()

2012-09-17 Thread Christian Heimes

Christian Heimes added the comment:

Have you tried code points beyond the BMP?

The C function doesn't have a return value that signals an error. An explicit 
check of errno is required. http://linux.die.net/man/3/wcsxfrm

--
nosy: +christian.heimes

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15954] No error checking after using of the wcsxfrm()

2012-09-17 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

The wcsxfrm() function may fail but there is no error check code.

I don't know what exception type should be used here: OSError with an errno 
EINVAL or some specialized type. I can't prepare tests, because I don't know 
under what conditions it would be possible error, and whether we can get it on 
any system at all without broking some internal unicode object invariants.

--
components: Library (Lib), Windows
messages: 170592
nosy: loewis, storchaka
priority: low
severity: normal
status: open
title: No error checking after using of the wcsxfrm()
type: behavior
versions: Python 3.2, Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com