[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-patch-tracker] [patch #8157] regexp.cc: prevent cast of negative
From: |
Philipp Kutin |
Subject: |
[Octave-patch-tracker] [patch #8157] regexp.cc: prevent cast of negative floating point value to uint32_t. |
Date: |
Wed, 07 Aug 2013 11:09:32 +0000 |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:23.0) Gecko/20100101 Firefox/23.0 |
URL:
<http://savannah.gnu.org/patch/?8157>
Summary: regexp.cc: prevent cast of negative floating point
value to uint32_t.
Project: GNU Octave
Submitted by: pkutin
Submitted on: Wed 07 Aug 2013 11:09:31 AM GMT
Category: None
Priority: 5 - Normal
Status: None
Privacy: Public
Assigned to: None
Originator Email:
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
* regexp.cc: in the expression "static_cast<size_t> (p->end () - 1) + 1", the
cast binds to "(p->end () - 1)". p->end() returns a 'double' which may be
zero. In that case, undefined behavior would be subsequently invoked.
Enclosing the "+ 1" into parens before the cast fixes the problem.
The case can be produced with this test:
assert (regexprep ('World', '^', 'Hello ', 'emptymatch'), 'Hello World')
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Wed 07 Aug 2013 11:09:31 AM GMT Name:
regexp-cc-prevent-cast-of-negative.patch Size: 1kB By: pkutin
<http://savannah.gnu.org/patch/download.php?file_id=28785>
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/patch/?8157>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-patch-tracker] [patch #8157] regexp.cc: prevent cast of negative floating point value to uint32_t.,
Philipp Kutin <=