Skip to content

Commit 26399a7

Browse files
authored
Merge pull request #1057 from jfcg/master
CodeQL & fixes
2 parents 756b4d7 + 0870776 commit 26399a7

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
7+
jobs:
8+
analyze:
9+
name: Analyze
10+
runs-on: ubuntu-latest
11+
permissions:
12+
actions: read
13+
contents: read
14+
security-events: write
15+
16+
steps:
17+
- name: Checkout repo
18+
uses: actions/checkout@v2
19+
20+
- name: Initialize CodeQL
21+
uses: github/codeql-action/init@v1
22+
with:
23+
languages: 'go'
24+
25+
- name: CodeQL Analysis
26+
uses: github/codeql-action/analyze@v1

array.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -587,8 +587,8 @@ func (a *Int32Array) scanBytes(src []byte) error {
587587
} else {
588588
b := make(Int32Array, len(elems))
589589
for i, v := range elems {
590-
var x int
591-
if x, err = strconv.Atoi(string(v)); err != nil {
590+
x, err := strconv.ParseInt(string(v), 10, 32)
591+
if err != nil {
592592
return fmt.Errorf("pq: parsing array element index %d: %v", i, err)
593593
}
594594
b[i] = int32(x)

encode.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ func parseBytea(s []byte) (result []byte, err error) {
559559
if len(s) < 4 {
560560
return nil, fmt.Errorf("invalid bytea sequence %v", s)
561561
}
562-
r, err := strconv.ParseInt(string(s[1:4]), 8, 9)
562+
r, err := strconv.ParseUint(string(s[1:4]), 8, 8)
563563
if err != nil {
564564
return nil, fmt.Errorf("could not parse bytea value: %s", err.Error())
565565
}

0 commit comments

Comments
 (0)