Hacking Possible fix for the WBFS corruption

AllWiidUp

Well-Known Member
OP
Newcomer
Joined
Dec 17, 2008
Messages
84
Trophies
0
XP
31
Country
Canada
Looking at the WBFS alloc and free functions I noticed an off by 1 error, that likely frees the wrong block.

in libwbfs.c:

CODE--- a/libwbfs.cÂÂ 2009-03-31 18:26:00.000000000 -0700
+++ b/libwbfs.cÂÂÂÂ 2009-04-12 12:28:23.516024000 -0700
@@ -389,8 +389,8 @@
}
static void free_block(wbfs_t *p,int bl)
{
-ÂÂÂÂÂÂÂÂint i = bl/(32);
-ÂÂÂÂÂÂÂÂint j = bl&31;
+ÂÂÂÂÂÂÂÂint i = (bl-1)/(32);
+ÂÂÂÂÂÂÂÂint j = (bl-1)&31;
ÂÂÂÂÂÂÂÂ u32 v = wbfs_ntohl(p->freeblks);
ÂÂÂÂÂÂÂÂ p->freeblks = wbfs_htonl(v | 1freeblks);
ÂÂÂÂÂÂÂÂp->freeblks = wbfs_htonl(v | 1wlba_table); // bl = info->wlba_table
ÂÂÂÂÂÂÂÂÂÂif (iwlba)
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂfree_block(p,iwlba); // should have beenÂÂfree_block(p,iwlba - 1);[/code]
but since "alloc_block" adds the +1 then "free_block" should have the -1, otherwise someone else might introduce the bug again, if the use free_block in another place since both block functions are used for "wlba_table".



EDIT:
WiiNinja compiled and tested a windows version with the fix and all it well ;P
WBFS.Windows.with.free.space.fix

now supported in WBFuse

Managers with Support:
WBFS Manager 2.2


Loaders with support:
KongsNutz Loader
Waninkoko v1.4
 

AllWiidUp

Well-Known Member
OP
Newcomer
Joined
Dec 17, 2008
Messages
84
Trophies
0
XP
31
Country
Canada
Mark McDonut said:
you should contact qwiirk or waninkoko, you really may be on to something.


I don't know Kwiirk's contact info and since he did up this version, I thought I'd put it out there in case he could see.
 

OuahOuah

Well-Known Member
Member
Joined
Oct 2, 2006
Messages
1,072
Trophies
1
Age
46
Location
France
Website
www.ouahouah.eu
XP
764
Country
France
He's on Wiibrew
smile.gif
 

FenrirWolf

Well-Known Member
Member
Joined
Nov 19, 2008
Messages
4,347
Trophies
1
Location
Sandy, UT
XP
615
Country
United States
So in what manner would this possibly fix the corruption? Would it cause a game to move the other games out of the way instead of overwriting them or something?
 

FoGBaV

Well-Known Member
Newcomer
Joined
Jan 31, 2008
Messages
82
Trophies
0
Age
52
Website
Visit site
XP
128
Country
Can someone confirm this fix - this would be the best Loader out there ... a Loader with no corruption in the file system ! 8)
 

FoGBaV

Well-Known Member
Newcomer
Joined
Jan 31, 2008
Messages
82
Trophies
0
Age
52
Website
Visit site
XP
128
Country
Its the libwbfs ... so its part of something when compiled ... so the usb loader has this code in it i guess ...
also the wbfs tools ...
 

djtaz

PM's Full - Wadder Me
Member
Joined
Sep 21, 2008
Messages
2,997
Trophies
0
Age
51
Website
Visit site
XP
101
Country
It would be a great find if its the fix - its been bugging everyone and makes the format seem a little unstable for most.
well done AllWiidup
 

Blue-K

No right of appeal.
Member
Joined
Jun 21, 2008
Messages
2,572
Trophies
0
Location
Helvetica
XP
209
Country
Swaziland
That's awesome!!!
smile.gif
.Good work! Have you maybe also found the bug why games can't be dumped by the Wii to a Partition over 512GB
tongue.gif
? That would be also awesome
wink.gif
.
 

wiiNinja

Well-Known Member
Member
Joined
Jan 13, 2009
Messages
645
Trophies
1
XP
1,756
Country
United States
QUOTE said:
You're completely right. It frees an incorrect block (we don't free the first block of the game, but we free the first block next to the last block of the game).

Finally, the bug is found. Thanks AllWiidup.
 

--=ZerO=--

Well-Known Member
Member
Joined
Jan 18, 2006
Messages
279
Trophies
0
XP
263
Country
Gambia, The
waninkoko said:
You're completely right. It frees an incorrect block (we don't free the first block of the game, but we free the first block next to the last block of the game).

So... i see... i'm sure u and kwiirk will fix this very soon... CIOS11 is on it's way.
wink.gif

U guys are great!
 

wiiNinja

Well-Known Member
Member
Joined
Jan 13, 2009
Messages
645
Trophies
1
XP
1,756
Country
United States
QUOTE said:
yeah, and? I thougth it's a problem of libwbfs and not the loader...

THe loader contains wbfs code for adding/deleting ISOs.

Version 1.3 does not fix this problem. I suspect 1.4.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    SylverReZ @ SylverReZ: You could say the same for a couple or so threads that used to be popular, I guess.