(name string, base string, fieldLimit uint32)
| 65 | } |
| 66 | |
| 67 | func (u *unmarshalGen) assignArray(name string, base string, fieldLimit uint32) { |
| 68 | if !u.p.ok() { |
| 69 | return |
| 70 | } |
| 71 | u.p.printf("\n%s, bts, err = msgp.Read%sBytes(bts)", name, base) |
| 72 | u.p.wrapErrCheck(u.ctx.ArgsStr()) |
| 73 | |
| 74 | // Determine effective limit: field limit > context field limit > file limit |
| 75 | var limit uint32 |
| 76 | var limitName string |
| 77 | |
| 78 | if fieldLimit > 0 { |
| 79 | // Explicit field limit passed as parameter |
| 80 | limit = fieldLimit |
| 81 | limitName = fmt.Sprintf("%d", fieldLimit) |
| 82 | } else if u.ctx.currentFieldArrayLimit != math.MaxUint32 { |
| 83 | // Field limit from context (set during field processing) |
| 84 | limit = u.ctx.currentFieldArrayLimit |
| 85 | limitName = fmt.Sprintf("%d", u.ctx.currentFieldArrayLimit) |
| 86 | } else if u.ctx.arrayLimit != math.MaxUint32 { |
| 87 | // File-level limit |
| 88 | limit = u.ctx.arrayLimit |
| 89 | limitName = fmt.Sprintf("%slimitArrays", u.ctx.limitPrefix) |
| 90 | } |
| 91 | |
| 92 | if limit > 0 && limit != math.MaxUint32 { |
| 93 | u.p.printf("\nif %s > %s {", name, limitName) |
| 94 | u.p.printf("\nerr = msgp.ErrLimitExceeded") |
| 95 | u.p.printf("\nreturn") |
| 96 | u.p.printf("\n}") |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | func (u *unmarshalGen) assignMap(name string, base string, fieldLimit uint32) { |
| 101 | if !u.p.ok() { |
no test coverage detected