Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove outdated lint #1111

Merged
merged 1 commit into from
Feb 3, 2023
Merged

Conversation

olivereanderson
Copy link
Contributor

Description of change

This removes the lintPtrNullWithoutFree(content) function which is used when building the Wasm/TS/JS bindings.

The lint was introduced to catch generated code that nulls out Wasm pointers without de-registering the finalizer (we build our bindings with the --weak-refs flag for automatic garbage collection see this section of the wasm-bindgen reference).

As of wasm-bindgen PR #3117 which is included in version 0.2.84 of wasm-bindgen such problematic code is no longer generated hence the lint is no longer needed.

How the change has been tested

Tested building this code (in wasm_core_did.rs)

impl WasmCoreDID {
  //.. 

  /// Swaps the contents and consumes `other`.  
  #[wasm_bindgen]
  pub fn swap(&mut self, mut other: WasmCoreDID) {
    std::mem::swap(&mut self.0, &mut other.0);
  }
  
  #[wasm_bindgen(js_name = moveOther)]
  pub fn move_other(other: WasmCoreDID) -> WasmCoreDID {
    other
    }
 }

#[wasm_bindgen]
extern "C" {
  #[wasm_bindgen(typescript_type = "CoreDID | ICoreDID")]
  pub type ICoreDID;

  #[wasm_bindgen(method, js_name= toCoreDid)]
  pub fn to_core_did(this: &ICoreDID) -> WasmCoreDID;

}

with wasm-bindgen version 0.2.83 and 0.2.84. In the former the lint is triggered by all three of those functions, while in version 0.2.84 the lint passes.

Change checklist

Add an x to the boxes that are relevant to your changes.

  • I have followed the contribution guidelines for this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@olivereanderson olivereanderson self-assigned this Feb 3, 2023
@olivereanderson olivereanderson added Chore Tedious, typically non-functional change Wasm Related to Wasm bindings. Becomes part of the Wasm changelog and removed Wasm Related to Wasm bindings. Becomes part of the Wasm changelog labels Feb 3, 2023
@olivereanderson olivereanderson added this to the v0.7 Features milestone Feb 3, 2023
@olivereanderson olivereanderson added the No changelog Excludes PR from becoming part of any changelog label Feb 3, 2023
@olivereanderson olivereanderson merged commit 6225c8a into main Feb 3, 2023
@olivereanderson olivereanderson deleted the chore/remove-outdated-UAF-lint branch February 3, 2023 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Chore Tedious, typically non-functional change No changelog Excludes PR from becoming part of any changelog
Projects
Development

Successfully merging this pull request may close these issues.

2 participants