Jump to content


Photo

Please make the Patch IF -function validation a little more through...


  • Please log in to reply
No replies to this topic

#1 The Imp

The Imp

    Not good, see EVIL is better. You'll LIVE.

  • Member
  • 5148 posts

Posted 22 October 2013 - 02:08 AM

Code example taken from the current 1ppv4.1.0's; 1pp/install/202_spelltweak.tph:

            ACTION_IF (FILE_EXISTS_IN_GAME ~SPWI317.SPL~) THEN BEGIN
            COPY_EXISTING ~SPWI317.SPL~ ~override~
            PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN // protects against invalid files
            WRITE_LONG 0x2c2 0
            WRITE_ASCII 0x2be ~1WDGARMR~
            END
            BUT_ONLY_IF_IT_CHANGES
            END

Now the problem with the code is that the files Source size of 0x72 or less is way too short to account the the fact that there is a bites in the 0x2c2 and 0x2be addresses of the file. Especially if the file is modified by any other mod in the chain... so reading an address near the 0x200 could validate the action, better yet reading and make sure the effects OPcode is correct would be better though, but the fact that there's a number at 0x72 does not.

There's surely several of these and so making the file checks a little more thorough will take a lot of coding, but you should make it.

 

Yeah, I didn't originally see this, but decided to report it here to make sure you see it.


Edited by The Imp, 22 October 2013 - 02:45 AM.

Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit). 
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.