You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@stdcxx.apache.org by "Travis Vitek (JIRA)" <ji...@apache.org> on 2008/06/04 04:16:44 UTC
[jira] Issue Comment Edited: (STDCXX-955) infinite loop or out of
bound access when slicing valarray
[ https://issues.apache.org/jira/browse/STDCXX-955?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12602143#action_12602143 ]
vitek edited comment on STDCXX-955 at 6/3/08 7:15 PM:
-------------------------------------------------------------
{noformat}
2008-06-03 Travis Vitek <vi...@roguewave.com>
STDCXX-955
* include/valarray (gslice::ind_numb): Correctly calculate
index count when the length array contains a zero.
* src/valarray.cpp (next_ind): Correctly calculate next index
when the length array contains a zero.
* tests/numerics/26.class.gslice.cpp (make_array): Update to
handle empty strings or other poorly formatted input.
(get_array_size): Correctly calculate index count when the
slice has a size array that contains a zero.
(next_index): Correctly calculate next index when the length
array contains a zero.
(test_gslice): Remove unnecessary linefeed from assertion.
(run_test): Update degenerate testcase to match comment.
* tests/regress/26.valarray.sub.stdcxx-995.cpp: Add new
regression test.
{noformat}
was (Author: vitek):
{noformat}
2008-06-03 Travis Vitek <vi...@roguewave.com>
STDCXX-955
* include/valarray (gslice::ind_numb): Correctly calculate
index count when the length array contains a zero.
* src/valarray.cpp (next_ind): Correctly calculate next index
when the length array contains a zero.
* tests/numerics/26.class.gslice.cpp (make_array): Update to
handle empty strings or other poorly formatted input.
(get_array_size): Correctly calculate index count when the
slice has a size array that contains a zero.
(next_index): Correctly calculate next index when the length
array contains a zero.
(test_gslice): Remove unnecessary linefeed from assertion.
(run_test): Update degenerate testcase to match comment.
{noformat}
> infinite loop or out of bound access when slicing valarray
> ----------------------------------------------------------
>
> Key: STDCXX-955
> URL: https://issues.apache.org/jira/browse/STDCXX-955
> Project: C++ Standard Library
> Issue Type: Bug
> Components: 26. Numerics
> Affects Versions: 4.2.1
> Reporter: Travis Vitek
> Assignee: Travis Vitek
> Fix For: 4.2.2
>
> Attachments: stdcxx-955.patch
>
> Original Estimate: 4h
> Remaining Estimate: 4h
>
> The current valarray code does not handle creating a gslice that has a one or more empty steps. The following testcase will hang in an infinite loop.
> {noformat}
> #include <cstdlib>
> #include <valarray>
> int main ()
> {
> const std::size_t p_leng [] = { 0 };
> const std::size_t p_strd [] = { 0 };
> const std::valarray<std::size_t> va_leng (p_leng,
> sizeof (p_leng) / sizeof (*p_leng));
> const std::valarray<std::size_t> va_strd (p_strd,
> sizeof (p_strd) / sizeof (*p_strd));
> const std::gslice gs_slice (1, va_leng, va_strd);
> std::valarray<char> va_lhs (10, '!');
> va_lhs [gs_slice] = '?';
> return 0;
> }
> {noformat}
> Changing the declarations of {{p_len}} and {{p_strd}} to the following will result in an assertion or an out of bound access depending on build type.
> {noformat}
> const std::size_t p_leng [] = { 2, 0 };
> const std::size_t p_strd [] = { 1, 3 };
> {noformat}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.