Author Topic: Ah, winAPI  (Read 3316 times)

0 Members and 1 Guest are viewing this topic.

Offline blackhole

  • Still not over the rainbow
  • 29
  • Destiny can suck it
    • Black Sphere Studios
Finishing an update for my document encryptor app, I discovered that the default behavior of the rich edit textbox control (copy selected text to clipboard) had an interesting effect of locking up any application that that text was pasted into. So I had to override that functionality and put the text into the clipboard myself to prevent my program from becoming a weapon of mass lockup.

Only winAPI locks itself up.

EDIT: I retract that statement. Even after replacing the copy code with my own, the bug pops up erractically in completely random circumstaces. First it only happens on the start menu, then it only happens OFF the start menu. Then it doesn't happen at all. Then it DOES. it's completely ****ing random.

Oh, and when I paste the copy-text-of-doom to anyone on MSN, it crashes both my client and theirs.

I can crash people's MSN by pasting text into my window.

Wow.
« Last Edit: May 08, 2009, 09:19:50 pm by blackhole »

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
With great power comes great responsibility. :p
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline captain-custard

  • previously known as andicirk
  • 210
  • one sandwich short of a picnic
is this availible for download ; it sounds like a useful  chat weapon
"Duct tape is like the force. It has a light side, a dark side, and it holds the universe together."

 

Offline blackhole

  • Still not over the rainbow
  • 29
  • Destiny can suck it
    • Black Sphere Studios
Sadly the MSN thing only happened about 4 times and then the effect mysteriously vanished. Either way I finally nailed the bug for good after preventing the textbox from processing the copy request. I'm fairly sure it was copying the text to the clipboard without a null terminator because when I accidentally copied the text to the clipboard without a null terminator I achieved the same effect.

This, of course, begs the question, WHY is the default behavoir of the rich edit control to copy text to the clipboard without a null terminator? and for that matter, why does not having a null terminator on the text create a paste-of-doom with the power to crash any application except notepad? For that matter the only explanation for the MSN crash thing is that I managed to create a buffer overrun by pasting text.

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
microsoft windows.


asside from that are you useing any threads in this thing?
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline blackhole

  • Still not over the rainbow
  • 29
  • Destiny can suck it
    • Black Sphere Studios
microsoft windows.


asside from that are you useing any threads in this thing?

Nope. It's just a text editor. One window with a big fat huge rich textbox control.

  
I can answer the 'paste of doom' part for you. NULL termination is part of the spec. If you don't follow the spec, the results are undefined.
As for why there isn't NULL termination, you'll have to show us how you're getting data out of the textbox.
STRONGTEA. Why can't the x86 be sane?

 

Offline blackhole

  • Still not over the rainbow
  • 29
  • Destiny can suck it
    • Black Sphere Studios
I can answer the 'paste of doom' part for you. NULL termination is part of the spec. If you don't follow the spec, the results are undefined.
As for why there isn't NULL termination, you'll have to show us how you're getting data out of the textbox.

Well that's the thing - I have no control over it. It was the default built-in behavior of the textbox itself. Without any intervention with me, hitting ctrl-C created a paste-of-doom.

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
I'm thinking you are some how overwriting the null terminator. somehow...
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline blackhole

  • Still not over the rainbow
  • 29
  • Destiny can suck it
    • Black Sphere Studios
I'm thinking you are some how overwriting the null terminator. somehow...

But HOW?! I don't modify or touch the textbox internals in any way whatsoever!