Jump to content

Fullscreen resolution overflow fix


Recommended Posts

  • Forum Moderator

Hello,

As a certain someone pointed out with pseudo code, a new fix has made its way onto the official binaries. This fix is really small and specific as it would almost never be triggered, unless you specifically trigger it yourself.

How to reproduce?

Basically, edit the file metin2.cfg and replace the resolution (WIDTH / HEIGHT) with those three lines.

WIDTH 32767
HEIGHT 32767
WINDOWED 0

Unless you have a very unusual and gigantic screen and resolution, it will basically crash, saying that your game doesn't support DirectX, stuff like that.

How to fix?

Spoiler

This is the hidden content, please

Edit:

Additional fix for overflow and negatives values here:

 

Have a nice day! 😄

 

Edited by Gurgarath
  • Metin2 Dev 113
  • Eyes 2
  • Smile Tear 2
  • Think 2
  • Confused 1
  • Scream 1
  • Good 28
  • Love 7
  • Love 47

Gurgarath
coming soon

Link to comment
Share on other sites

  • Premium
1 hour ago, Lead0b110010100 said:

But... why should someone do that xDD

And why should a server admin care hahahha

..No matter how useless it is. It's still a shared free fix, why comment like that?

  • Metin2 Dev 3
  • Scream 1
  • Good 2
  • Love 1

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

Link to comment
Share on other sites

  • Forum Moderator
3 hours ago, Lead0b110010100 said:

But... why should someone do that xDD

And why should a server admin care hahahha

That's a reversed fix. Most likely they fixed it because they got aware of this and decided to fix it. Of course it is very rare, I didn't even know you could abuse it in fullscreen before "reading" the assembly. I would say any server adming caring about things like this and details is a good admin, but that's my two cents on the question. It's a small and free fix anyway, you're free to use it or not 😄

  • Scream 1
  • Love 6

Gurgarath
coming soon

Link to comment
Share on other sites

2 hours ago, Gurgarath said:

That's a reversed fix. Most likely they fixed it because they got aware of this and decided to fix it. Of course it is very rare, I didn't even know you could abuse it in fullscreen before "reading" the assembly. I would say any server adming caring about things like this and details is a good admin, but that's my two cents on the question. It's a small and free fix anyway, you're free to use it or not 😄

Oh wow, my comment got more backlash than I thought it would. I was like "Why should someone put such a crazy value there, that's stupid as hell. But someone did, so did you find a fix for it."

The problem we are trying to solve here is not a new one, try entering 9000000000 as a value for the width parameter for example. It will also overflow, resulting in a 'random' value of m_Config.width or a crash. We can't really 'fix' the underlying problem here, which is that serialization of numbers can result in overflows. If you take a 8 bit data type like 'long long' instead of the 4 bit 'int' for m_Config.width, someone could still write a bigger number. What I wan't to say is:

This check might result in randomly true or false, regarding the value after the overflow in the config parameter.

if (m_Config.width >= screen_width_1)

Sorry if my first comment sounded rude or offensive, it was definitely not meant like that.

  • Good 2
Link to comment
Share on other sites

  • Forum Moderator
4 hours ago, Lead0b110010100 said:

Oh wow, my comment got more backlash than I thought it would. I was like "Why should someone put such a crazy value there, that's stupid as hell. But someone did, so did you find a fix for it."

The problem we are trying to solve here is not a new one, try entering 9000000000 as a value for the width parameter for example. It will also overflow, resulting in a 'random' value of m_Config.width or a crash. We can't really 'fix' the underlying problem here, which is that serialization of numbers can result in overflows. If you take a 8 bit data type like 'long long' instead of the 4 bit 'int' for m_Config.width, someone could still write a bigger number. What I wan't to say is:

This check might result in randomly true or false, regarding the value after the overflow in the config parameter.

if (m_Config.width >= screen_width_1)

Sorry if my first comment sounded rude or offensive, it was definitely not meant like that.

Don't worry, mine wasn't supposed to sound harsh as well. It's just funny because this kind of comment is a bit of a meme on the community. However, regarding your message I wasn't able to reproduce it at all. I however managed to trigger the bug by putting negative value.

Here is the proper fix for both, I included the theoric fix about what you said, you can "merge" the fixes to make it look more compact but for learning purposes I made it longer. The bug still occured (so still occurs on official binaries) if you add a negative value in fullscreen mode. Which doesn't occur in Windowed mode.

Spoiler

This is the hidden content, please

 

 

Edited by Gurgarath
  • Metin2 Dev 32
  • Think 1
  • Good 7
  • Love 5

Gurgarath
coming soon

Link to comment
Share on other sites

const uint32_t width = m_Config.bWindowed ? GetSystemMetrics(SM_CXFULLSCREEN) : GetSystemMetrics(SM_CXSCREEN);
const uint32_t height = m_Config.bWindowed ? GetSystemMetrics(SM_CYFULLSCREEN) : GetSystemMetrics(SM_CYSCREEN);

if (m_Config.width >= width)
	m_Config.width = width;

if (m_Config.height >= height)
	m_Config.height = height;

This version looks better imho.

Edited by Thorek
  • Metin2 Dev 3
  • Scream 2
  • Good 2
Link to comment
Share on other sites

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.