generate: Validate OTA tags properly
This commit is contained in:
parent
c4dd129fc5
commit
a9f583d2e7
@ -610,23 +610,17 @@ func (this *Generator) generateDecodeBranch(hash [16]byte, typ Type) (n int, err
|
||||
n += nn; if err != nil { return n, err }
|
||||
return n, nil
|
||||
}
|
||||
|
||||
// FIXME: the tag is validated improperly, the result of
|
||||
// generateTag means basically nothing here because
|
||||
// there is no data in the destination, we need another
|
||||
// function that checks if a tag can be assigned to a
|
||||
// PDL type
|
||||
|
||||
// validate header
|
||||
// TODO: here, validate that length is less than the
|
||||
// max, whatever that is configured to be. the reason we
|
||||
// want to read it here is that we would have to skip
|
||||
// the tag anyway so why not.
|
||||
nn, err = this.iprintf("if %s != ", elementTagVar)
|
||||
nn, err = this.iprintf("if !(")
|
||||
n += nn; if err != nil { return n, err }
|
||||
nn, err = this.generateTag(typ.Element, "(*this)")
|
||||
nn, err = this.generateCanAssign(typ.Element, elementTagVar)
|
||||
n += nn; if err != nil { return n, err }
|
||||
nn, err = this.printf(" {\n")
|
||||
nn, err = this.printf(") {\n")
|
||||
n += nn; if err != nil { return n, err }
|
||||
this.push()
|
||||
nn, err = abort()
|
||||
|
Loading…
x
Reference in New Issue
Block a user