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

Internal Error in Expression2 Script with @strict: WriteDouble Argument Issue #3248

Open
KemGus opened this issue Jan 22, 2025 · 1 comment

Comments

@KemGus
Copy link

KemGus commented Jan 22, 2025

Description:
When running an Expression2 script with @strict enabled, an undefined variable (Tut_Warning) causes a Wiremod internal error instead of a proper E2 error. This behavior is unexpected, as @strict should catch undefined variables and throw an E2 error, not a Wiremod-level error.

  • The issue occurs specifically when @strict is enabled.
  • The variable Tut_Warning is never defined, which should trigger an E2 error instead of hard wiremod error
  • The error seems to propagate to the Wiremod level, causing an internal error instead of being caught by the E2 runtime.

Code:

@strict

if(first() | dupefinished()){
    
    Green = vec(0, 255,0)
    Red = vec(255, 0, 0)
    Tutorial = 0
    
    if(Tutorial){
        
        Tut_Warning = 0

    }

    if(!Tut_Warning & Tutorial){
        printColor(Green, "Ready to use!")
    }
    elseif(Tut_Warning){
        printColor(Red, "Warnings: ", Tut_Warning, ", Follow instructions!")
    }
    
}

Error Message:

[Wiremod Canary] Warning! A net message (wire_expression2_printColor) is already started! Discarding in favor of the new message! (wire_clienterror)
  1. ClientError - lua/wire/wireshared.lua:311
   2. Error - lua/entities/gmod_wire_expression2/init.lua:323
    3. Execute - lua/entities/gmod_wire_expression2/init.lua:150
     4. Setup - lua/entities/gmod_wire_expression2/init.lua:559
      5. func - lua/wire/stools/expression2.lua:441
       6. unknown - lua/includes/extensions/net.lua:37

sv: Expression 2 (generic): Internal error 'entities/gmod_wire_expression2/core/debug.lua:321: bad argument #1 to 'WriteDouble' (number expected, got nil)' at line 23, char 5
@thegrb93
Copy link
Contributor

thegrb93 commented Jan 22, 2025

Even worse, it's feeding the variable into the printColor function which is invoking the error. Being able to feed functions types they shouldn't be allowed to take poses a huge security concern, although it seems it might only occur for undefined types which default to number.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants