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

Crash in genGoOpStruct due to invalid function name #132

Open
lVlayhem opened this issue May 7, 2020 · 4 comments
Open

Crash in genGoOpStruct due to invalid function name #132

lVlayhem opened this issue May 7, 2020 · 4 comments

Comments

@lVlayhem
Copy link

lVlayhem commented May 7, 2020

Hi, I had an issue with this package when converting my WSDL.
Here's the traceback:

2020/05/07 14:42:49 function is nil! bo: &{XMLName:{Space:http://schemas.xmlsoap.org/wsdl/ Local:operation} Name:changeOwnPassword Operation:{XMLName:{Space: Local:} Action:} Operation11:{XMLName:{Space:http://schemas.xmlsoap.org/wsdl/soap/ Local:operation} Action:} Input:0xc0001c0920 Output:0xc0001c0a80}, bo.Name: changeOwnPassword, name: ChangeOwnPassword, funcs: map[changeOwnPassword:0xc000423130 convertLead:0xc000422dc0 create:0xc000422af0 delete:0xc000422c30 describeAllTabs:0xc000422a50 describeAppMenu:0xc0004225a0 describeApprovalLayout:0xc0004228c0 describeAvailableQuickActions:0xc000423400 describeCompactLayouts:0xc000422820 describeDataCategoryGroupStructures:0xc000422500 describeDataCategoryGroups:0xc0004224b0 describeGlobal:0xc000422460 describeGlobalTheme:0xc0004225f0 describeKnowledgeSettings:0xc000422550 describeLayout:0xc000422690 describeNouns:0xc000423590 describePathAssistants:0xc000422870 describePrimaryCompactLayouts:0xc000422aa0 describeQuickActions:0xc0004233b0 describeSObject:0xc0004223c0 describeSObjectListViews:0xc0004229b0 describeSObjects:0xc000422410 describeSearchLayouts:0xc000422730 describeSearchScopeOrder:0xc0004227d0 describeSearchableEntities:0xc000422780 describeSoftphoneLayout:0xc0004226e0 describeSoqlListViews:0xc000422910 describeTabs:0xc000422a00 describeTheme:0xc000422640 describeVisualForce:0xc0004234a0 emptyRecycleBin:0xc000422cd0 executeListView:0xc000422960 findDuplicates:0xc0004234f0 findDuplicatesByIds:0xc000423540 getDeleted:0xc000422eb0 getServerTimestamp:0xc000423090 getUpdated:0xc000422f00 getUserInfo:0xc0004231d0 invalidateSessions:0xc000422e60 login:0xc000422370 logout:0xc000422e10 merge:0xc000422be0 performQuickActions:0xc000423360 process:0xc000422d70 query:0xc000422f50 queryAll:0xc000422fa0 queryMore:0xc000422ff0 renderEmailTemplate:0xc0004232c0 renderStoredEmailTemplate:0xc000423310 resetPassword:0xc000423180 retrieve:0xc000422d20 retrieveQuickActionTemplates:0xc000423450 search:0xc000423040 sendEmail:0xc000423270 sendEmailMessage:0xc000423220 setPassword:0xc0004230e0 undelete:0xc000422c80 update:0xc000422b40 upsert:0xc000422b90]

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x77e6f8]

goroutine 1 [running]:
github.com/fiorix/wsdl2go/wsdlgo.(*goEncoder).genGoOpStruct(0xc0001a42c0, 0x8e2920, 0xc00020ca50, 0xc00019a000, 0xc0000a3040, 0x0, 0x0)
/home/bolzhatov/go/src/github.com/fiorix/wsdl2go/wsdlgo/encoder.go:1375 +0x98
github.com/fiorix/wsdl2go/wsdlgo.(*goEncoder).writeGoTypes(0xc0001a42c0, 0x8e2920, 0xc0001e0f30, 0xc00019a000, 0x0, 0x0)
/home/bolzhatov/go/src/github.com/fiorix/wsdl2go/wsdlgo/encoder.go:1124 +0x329
github.com/fiorix/wsdl2go/wsdlgo.(*goEncoder).encode(0xc0001a42c0, 0x8e2920, 0xc0001e0ed0, 0xc00019a000, 0x7f1d60a4ffff, 0xc00018fab0)
/home/bolzhatov/go/src/github.com/fiorix/wsdl2go/wsdlgo/encoder.go:224 +0x327
github.com/fiorix/wsdl2go/wsdlgo.(*goEncoder).Encode(0xc0001a42c0, 0xc00019a000, 0x0, 0x0)
/home/bolzhatov/go/src/github.com/fiorix/wsdl2go/wsdlgo/encoder.go:149 +0xa2
main.codegen(0x8e2f40, 0xc0000ae008, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/home/bolzhatov/go/src/github.com/fiorix/wsdl2go/main.go:90 +0x27e
main.main()
/home/bolzhatov/go/src/github.com/fiorix/wsdl2go/main.go:61 +0x43e

I've added logging in case function is nil to debug this:

if function == nil {
    log.Printf("function is nil! bo: %+v, bo.Name: %+v, name: %+v, funcs: %+v", bo, bo.Name, name, ge.funcs)
}

Where the panic occurs:

if function.Input == nil {

To fix the issue with my WSDL I've added the next lines:

if function == nil {
    function = ge.funcs[bo.Name]
}

ge.funcs does not contain function with name goSymbol(bo.Name) which is ChangeOwnPassword.
But it does contain function with name bo.Name which is changeOwnPassword.
Convertion is successful after the fix.

Here's the WSDL - https://pastebin.com/raw/91Dt2ERp

@YumeMichi
Copy link

Same problem here, I just reverted the latest commit.

@robbiet480
Copy link

@denysvitali @fiorix Any ideas? This issue appears to have been introduced in #131. My WSDL is here..

@denysvitali
Copy link
Contributor

I'll try to see whether I can find a fix that works for both your wsdl and the one posted in my issue. Sorry

@robbiet480
Copy link

It's okay, thanks for replying so fast!

denysvitali pushed a commit to denysvitali/wsdl2go that referenced this issue Jun 26, 2020
denysvitali added a commit to denysvitali/wsdl2go that referenced this issue Aug 1, 2020
@denysvitali denysvitali mentioned this issue Aug 1, 2020
gpedro added a commit to gpedro/wsdl2go that referenced this issue Aug 13, 2020
Co-authored-by: Denys Vitali <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants