Fabric Zero (Discontinued)

Fabric Zero (Discontinued)

11.9k Downloads

FabricZero modifies the access flag of every field, method, and class in the classpath

jellysquid3 opened this issue ยท 3 comments

commented

This is extremely dangerous, and it's not clear to me why it's being done. Relevant code appears here.

In particular, this is causing rather horrific issues with our options file serializer as it is configured to ignore private fields. Without the correct access modifiers, Gson will try to serialize the File and Gson types in the class, creating the following output:

  "file": {
    "separator_char": "/",
    "separator": "/",
    "path_separator_char": ":",
    "path_separator": ":"
  },
  "gson": {
    "d_e_f_a_u_l_t__j_s_o_n__n_o_n__e_x_e_c_u_t_a_b_l_e": false,
    "d_e_f_a_u_l_t__l_e_n_i_e_n_t": false,
    "d_e_f_a_u_l_t__p_r_e_t_t_y__p_r_i_n_t": false,
    "d_e_f_a_u_l_t__e_s_c_a_p_e__h_t_m_l": true,
    "d_e_f_a_u_l_t__s_e_r_i_a_l_i_z_e__n_u_l_l_s": false,
    "d_e_f_a_u_l_t__c_o_m_p_l_e_x__m_a_p__k_e_y_s": false,
    "d_e_f_a_u_l_t__s_p_e_c_i_a_l_i_z_e__f_l_o_a_t__v_a_l_u_e_s": false
  }

What's stranger is that it appears even other libraries are having their access flags modified, too. Trying to deserialize this blob results in Gson promptly crashing the process.

commented

Thanks for the report I will fix that in a future version of FabricZero

commented

It's done for compatibility between different versions of Minecraft.
Optifine put some methods that were previously public, private.
And fields are also to help fix mod compatibility between Minecraft version.
I change the access of all methods because if a parent method access is changed the child access needs to be changed to but it's not the case with fields so I will only change the access of the fields if it's a Minecraft class.

commented

if (minecraft) fieldNode.access = makePublic(fieldNode.access); // Fix https://github.com/Fox2Code/FabricZero/issues/4

Fixed :3