test/unit/string_test crashes in Debug on Windows

Bug #867271 reported by Daniel Turcanu
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Zorba
New
Medium
Paul J. Lucas

Bug Description

The Unit Test string_test is crashing on Windows in debug mode.
I am testing on no-unicode branch, for both unicode and ascii modes. It crashes for both modes.
My investigation leads to src/util/utf8_util_base.h: 379, when oi_ is incremented beyond the end of string, dereferencing the last \0 fires an assert in Windows.
I think you should check for end() before dereferencing the iterator.

Revision history for this message
Paul J. Lucas (paul-lucas) wrote :

Unfortunately, I don't have access to "end()" to compare it to. The only thing I can think of is to do:

if ( *oi ) while ( !is_start_byte( *++oi_ ) ) ;

Can you try that out and let me know? Thanks.

Revision history for this message
Matthias Brantner (matthias-brantner) wrote :

No that doesn't solve the problem. Before incrementing the iterator, it still points to the "o" of "hello" which is OK. Only after incrementing it on the "o", the iterator points to the end and Windows doesn't allow for calling the *operator on it anymore.

Chris Hillery (ceejatec)
tags: removed: core-runtime
Changed in zorba:
assignee: Daniel Turcanu (danielturcanu) → Paul J. Lucas (paul-lucas)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.