Jump to content

Automatic type cast in build array causes crash/data corruption


CHorn

Recommended Posts

When wiring variables of different types into a "build array" function, i.e. when automatic type casting is used, LV can crash completely or the resulting array can contain incorrect values.

The details depend on the exact configuration of the input for the build array function.

LV 8.01 and LV 8.20 (I discovered this using 8.01) seem to be affected on WinXP, Mac OSX (PPC) seems to be not affected.

This is a pretty nasty bug because instead of crashing it can result in incorrect numeric results and is then really hard to allocate because usually one does trust really essential basics of the programming language like automatic type casts.

P.S.: I posted this already in the NI forums but I thought this might be interesting...Download File:post-6991-1164671256.viDownload File:post-6991-1164671267.vi

Link to comment

It looks like the constant folding is doing very weird.

If you use execution highlighting, you will see that the for-loop will run just once...

N will be 100 and I will stay 0 :nono:

But if I change the contant to a complex type (cxt/cdb/csg) it will run 100 times (I=99)

Extended and double will run as well, other file types not...

However if I forced a data change to I32 I saw that I went to 1 and then got this:

post-2399-1164697021.png?width=400

oops :unsure:

EDIT: what is the NI-forums discussion link?

Ton

Link to comment
It looks like the constant folding is doing very weird.

My guess is that it's some kind of buffer overflow when allocating memory for the array that uses automatic type casts. This would explain why sometimes weird stuff happens and sometimes it crashes. In this example the loop gets "damaged".

EDIT: what is the NI-forums discussion link?

http://forums.ni.com/ni/board/message?boar...ssage.id=217205

I think this is a very grave bug. Fortunately it is restricted to certain input configurations and to the combination of complex double with integers (all kinds) and singles. I didn't test very thoroughly though.

Christian

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.