DownloadFile causes problems when it's redirected to HTTPS

Report any Hollywood bugs here
Post Reply
User avatar
jPV
Posts: 603
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

DownloadFile causes problems when it's redirected to HTTPS

Post by jPV »

I seem to have an issue when some of the URLs I've been using to download files have started to redirect HTTP URLs to HTTPS URLs. Couple of different sites I've been using have made such a change in last weeks...

Hollywood, of course, breaks in that situation with the "Unknown protocol in URL!" message, but there seems to be a bug, which can cause crashes too. It is caught as a hit to the MorphOS debug log.

When running this:

Code: Select all

; The http url is redirected to https at the server side, Hollywood causes a hit in these cases.
data$, count = DownloadFile("http://morph.zone/themes/MZ3/images/top_logo.png") 
I get this to the debug log:

Code: Select all

TLSF_FreeMem: ptr 0x23adb330 wrong size 335544372 (memory was allocated for 81-96 bytes)

>>> DumpTaskState
----------------------------------------------------------------------
      Task 0x238c1080 Name 0x238c1de4 <Background CLI> Type 13 Pri 0
     Flags 0x8 State 2 IDNestCnt -1 TDNestCnt -1
  SigAlloc 0xff00ffff    SigWait 0x40000000 SigRecvd 0x10000120 SigExcept 0x00000000
ExceptCode 0x10120af8 ExceptData 0x00000000 TrapCode 0x10120af0  TrapData 0x00000000
    Switch 0x00000000     Launch 0x00000000 UserData 0x00000000
   SPLower 0x238f789c    SPUpper 0x238f989c    SPReg 0x238f9834
----------------------------------------------------------------------
         ETask 0x238c1ec4
       MemPool 0x23585c90     PPCLibData 0x00000000
    PPCSPLower 0x23cd92f4     PPCSPUpper 0x23d192f0
PPCTrapMsgPort 0x00000000 PPCTrapMessage 0x23a3b6d4
   PPCRegFrame 0x239f70e0
     Private[] 0x00000000 0x00000000 0x00000000 0x00000000
    EmulHandle 0x00000000
----------------------------------------------------------------------
 EmulHandle 0x239f74d0     Type 0x00000004    Flags 0x00000001
----------------------------------------------------------------------
   SRR0 0x1011fd30 SRR1 0x02007030
     LR 0x00041e8c  CTR 0x00000000
     CR 0x20224884  XER 0x00000000
GPR[00] 000116bc 23d16ec0 239f74d0 00f16000 00b16010 00b1600c 00b16008 00000074
GPR[08] 00000044 00b16055 00b16054 00b16000 40224884 00000000 00000000 00000000
GPR[16] 23fe24ec 00000000 00000000 23d17c58 23d17858 23fda4dc 23d17a58 23adb334
GPR[24] 00000000 14001948 23d172c8 238c1ec4 238c1080 00000000 10020010 239f70e0
>>> Task Stack History
----------------------------------------------------------------------
StackFrame[ 0].LR[0x1011e4e4]
StackFrame[ 1].LR[0x101096ec]
StackFrame[ 2].LR[0x101054cc]
StackFrame[ 3].LR[0x1010a488]
StackFrame[ 4].LR[0x23c605f0] -> hollywood [Hunk 1 Offset 0x00163a18]
StackFrame[ 5].LR[0x23c2969c] -> hollywood [Hunk 1 Offset 0x0012cac4]
StackFrame[ 6].LR[0x23c2cd90] -> hollywood [Hunk 1 Offset 0x001301b8]
StackFrame[ 7].LR[0x23be54d4] -> hollywood [Hunk 1 Offset 0x000e88fc]
StackFrame[ 8].LR[0x23bfc768] -> hollywood [Hunk 1 Offset 0x000ffb90]
StackFrame[ 9].LR[0x23be5a3c] -> hollywood [Hunk 1 Offset 0x000e8e64]
StackFrame[10].LR[0x23be0bf8] -> hollywood [Hunk 1 Offset 0x000e4020]
StackFrame[11].LR[0x23be4bcc] -> hollywood [Hunk 1 Offset 0x000e7ff4]
StackFrame[12].LR[0x23be4cac] -> hollywood [Hunk 1 Offset 0x000e80d4]
StackFrame[13].LR[0x23be08fc] -> hollywood [Hunk 1 Offset 0x000e3d24]
StackFrame[14].LR[0x23b1b8f4] -> hollywood [Hunk 1 Offset 0x0001ed1c]
StackFrame[15].LR[0x23c661ac] -> hollywood [Hunk 1 Offset 0x001695d4]
StackFrame[16].LR[0x23b07408] -> hollywood [Hunk 1 Offset 0x0000a830]
StackFrame[17].LR[0x23c604c0] -> hollywood [Hunk 1 Offset 0x001638e8]
StackFrame[18].LR[0x23afd0a8] -> hollywood [Hunk 1 Offset 0x000004d0]
StackFrame[19].LR[0x23afcf40] -> hollywood [Hunk 1 Offset 0x00000368]
StackFrame[20].LR[0x1010f960]
>>> Full PPC mode: Last 68k context
----------------------------------------------------------------------
   PC 87654321 SR 0008
Dn[0] 14000034 00000000 00000000 ffffffff 1401ec54 23d17728 23ea2ae0 00006720
An[0] 238c1080 23adb330 00000000 23d1768c 11007694 14001948 14001948 238f9894
Stack: 0x238f9894
0x2000238c -> OWB Hunk 1 Offset 0x0100e754
0x1de023ad -> OWB Hunk 4 Offset 0x00129b2d
>>> Last saved PPCThread State
----------------------------------------------------------------------
SRR0 0x1011fc64 SRR1 0x200f030 LR 0x1010f06c R1 0x23d176f0
GPR[00] 23a7b080 23d176f0 239f74d0 14000000 23a7b080 00000038 00000038 14000048
GPR[08] ff0000c0 e1474150 00000038 14001948 23fea4f0 00000000 00000000 00000000
GPR[16] 23fe24ec 23fed544 00000000 23d17c58 23d17858 23fda4dc 23d17a58 23adb334
GPR[24] 00000000 23d17b58 23a7b084 14001948 14000030 23a7b0b8 23a7b080 14001948
  FPSCR 43efff0000104050
FPR[00] fff800000007c0ec c0a801073e4b8fe2 0415005000000000 0000000050000000
FPR[04] 0000000000000000 0000000000000000 0000000000000000 0000000000000000
FPR[08] 4002d97c7f3321d2 3f33f6a1db141fb9 41e0000000000000 4330000000000000
FPR[12] 411f03b132aaaaaa 3fff7cc41238aa1b 0000000000000000 0000000000000000
FPR[16] 0000000000000000 0000000000000000 0000000000000000 0000000000000000
FPR[20] 0000000000000000 0000000000000000 0000000000000000 0000000000000000
FPR[24] 0000000000000000 0000000000000000 0000000000000000 0000000000000000
FPR[28] 0000000000000000 0000000000000000 0000000000000000 0000000000000000

----------------------------------------------------------------------
    SegList 0x08e97988        GlobVec 0x1401ed64
  StackBase 0x08e3de27      StackSize 0x00002000
    TaskNum 0x00000008        Result2 0x00000000
 CurrentDir 0x08fa8170            CIS 0x07ba0333
        COS 0x08e8dae5            CES 0x07b9f1e1
ConsoleTask 0x239b4588 FileSystemTask 0x141b2294
        CLI 0x08e35d07     ReturnAddr 0x238f9894
    PktWait 0x00000000      WindowPtr 0x00000000
     HomeDir 0x08e907ae         Flags 0x00000044
    ExitCode 0x00000000      ExitData 0x00000000
   Arguments 0x235bc5b4  ShellPrivate 0x00000000
>>> End of DumpTaskState Dump
----------------------------------------------------------------------
NEW_Alert: MsgPort 0x23d176a0
NEW_Alert: Task 0x238c1080 <Background CLI>
NEW_Alert: Msg 0x23d17680
NEW_Alert: AlertMsgPort 0x140cdc78
NEW_Alert: Send Msg
NEW_Alert: Wait Msg
NEW_Alert: Replied Msg 0x23d17680
NEW_Alert: continue
TLSF_FreeMem: ptr 0x23adb368 wrong size 598586152 (memory was allocated for 4294967281-0 bytes)

>>> DumpTaskState
----------------------------------------------------------------------
      Task 0x238c1080 Name 0x238c1de4 <Background CLI> Type 13 Pri 0
     Flags 0x8 State 2 IDNestCnt -1 TDNestCnt -1
  SigAlloc 0xff00ffff    SigWait 0x00000010 SigRecvd 0x10000120 SigExcept 0x00000000
ExceptCode 0x10120af8 ExceptData 0x00000000 TrapCode 0x10120af0  TrapData 0x00000000
    Switch 0x00000000     Launch 0x00000000 UserData 0x00000000
   SPLower 0x238f789c    SPUpper 0x238f989c    SPReg 0x238f9834
----------------------------------------------------------------------
         ETask 0x238c1ec4
       MemPool 0x23585c90     PPCLibData 0x00000000
    PPCSPLower 0x23cd92f4     PPCSPUpper 0x23d192f0
PPCTrapMsgPort 0x00000000 PPCTrapMessage 0x23a3b6d4
   PPCRegFrame 0x239f70e0
     Private[] 0x00000000 0x00000000 0x00000000 0x00000000
    EmulHandle 0x00000000
----------------------------------------------------------------------
 EmulHandle 0x239f74d0     Type 0x00000004    Flags 0x00000001
----------------------------------------------------------------------
   SRR0 0x1011fd30 SRR1 0x02007030
     LR 0x1010eeac  CTR 0x00000000
     CR 0x88224888  XER 0x00000000
GPR[00] 000116bc 23d16ec0 239f74d0 00f16000 00b16010 00b1600c 00b16008 00000074
GPR[08] 00000044 00b16055 00b16054 00b16000 40224884 00000000 00000000 00000000
GPR[16] 23fe24ec 00000000 00000000 23d17c58 23d17858 23fda4dc 23d17a58 23adb334
GPR[24] 00000000 14001948 23d172c8 238c1ec4 238c1080 00000000 10020010 239f70e0
>>> Task Stack History
----------------------------------------------------------------------
StackFrame[ 0].LR[0x1011e4e4]
StackFrame[ 1].LR[0x101096ec]
StackFrame[ 2].LR[0x101054cc]
StackFrame[ 3].LR[0x1010a488]
StackFrame[ 4].LR[0x23c605f0] -> hollywood [Hunk 1 Offset 0x00163a18]
StackFrame[ 5].LR[0x23c296bc] -> hollywood [Hunk 1 Offset 0x0012cae4]
StackFrame[ 6].LR[0x23c2cd90] -> hollywood [Hunk 1 Offset 0x001301b8]
StackFrame[ 7].LR[0x23be54d4] -> hollywood [Hunk 1 Offset 0x000e88fc]
StackFrame[ 8].LR[0x23bfc768] -> hollywood [Hunk 1 Offset 0x000ffb90]
StackFrame[ 9].LR[0x23be5a3c] -> hollywood [Hunk 1 Offset 0x000e8e64]
StackFrame[10].LR[0x23be0bf8] -> hollywood [Hunk 1 Offset 0x000e4020]
StackFrame[11].LR[0x23be4bcc] -> hollywood [Hunk 1 Offset 0x000e7ff4]
StackFrame[12].LR[0x23be4cac] -> hollywood [Hunk 1 Offset 0x000e80d4]
StackFrame[13].LR[0x23be08fc] -> hollywood [Hunk 1 Offset 0x000e3d24]
StackFrame[14].LR[0x23b1b8f4] -> hollywood [Hunk 1 Offset 0x0001ed1c]
StackFrame[15].LR[0x23c661ac] -> hollywood [Hunk 1 Offset 0x001695d4]
StackFrame[16].LR[0x23b07408] -> hollywood [Hunk 1 Offset 0x0000a830]
StackFrame[17].LR[0x23c604c0] -> hollywood [Hunk 1 Offset 0x001638e8]
StackFrame[18].LR[0x23afd0a8] -> hollywood [Hunk 1 Offset 0x000004d0]
StackFrame[19].LR[0x23afcf40] -> hollywood [Hunk 1 Offset 0x00000368]
StackFrame[20].LR[0x1010f960]
>>> Full PPC mode: Last 68k context
----------------------------------------------------------------------
   PC 87654321 SR 0008
Dn[0] 23adb328 00000000 00000000 ffffffff 1401ec54 23d17728 23ea2ae0 00006720
An[0] 238c1080 23adb368 00000000 23d1768c 11007694 14001948 14001948 238f9894
Stack: 0x238f9894
0x2000238c -> OWB Hunk 1 Offset 0x0100e754
0x1de023ad -> OWB Hunk 4 Offset 0x00129b2d
>>> Last saved PPCThread State
----------------------------------------------------------------------
SRR0 0x1011fc64 SRR1 0x200f030 LR 0x1010f06c R1 0x23d17610
GPR[00] 000116bc 23d17610 239f74d0 00f16000 00b16010 00b1600c 00b16008 00000074
GPR[08] 00000044 00b16055 00b16054 00b16000 40224884 00000000 00000000 00000000
GPR[16] 23fe24ec 00000000 00000000 23d17c58 23d17858 23fda4dc 23d17a58 00000004
GPR[24] ffffffff 14001af0 14001aec 00000000 ffffffff 88224848 238c1080 14001948
  FPSCR 43efff0000104008
FPR[00] fff800000007c0ec c0a801073e4b8fe2 0415005000000000 0000000050000000
FPR[04] 0000000000000000 0000000000000000 0000000000000000 0000000000000000
FPR[08] 4002d97c7f3321d2 3f33f6a1db141fb9 41e0000000000000 4330000000000000
FPR[12] 411f03b132aaaaaa 0000000000000000 0000000000000000 0000000000000000
FPR[16] 0000000000000000 0000000000000000 0000000000000000 0000000000000000
FPR[20] 0000000000000000 0000000000000000 0000000000000000 0000000000000000
FPR[24] 0000000000000000 0000000000000000 0000000000000000 0000000000000000
FPR[28] 0000000000000000 0000000000000000 0000000000000000 0000000000000000

----------------------------------------------------------------------
    SegList 0x08e97988        GlobVec 0x1401ed64
  StackBase 0x08e3de27      StackSize 0x00002000
    TaskNum 0x00000008        Result2 0x00000000
 CurrentDir 0x08fa8170            CIS 0x07ba0333
        COS 0x08e8dae5            CES 0x07b9f1e1
ConsoleTask 0x239b4588 FileSystemTask 0x141b2294
        CLI 0x08e35d07     ReturnAddr 0x238f9894
    PktWait 0x00000000      WindowPtr 0x00000000
     HomeDir 0x08e907ae         Flags 0x00000044
    ExitCode 0x00000000      ExitData 0x00000000
   Arguments 0x235bc5b4  ShellPrivate 0x00000000
>>> End of DumpTaskState Dump
----------------------------------------------------------------------
NEW_Alert: MsgPort 0x23d176a0
NEW_Alert: Task 0x238c1080 <Background CLI>
NEW_Alert: Msg 0x23d17680
NEW_Alert: AlertMsgPort 0x140cdc78
NEW_Alert: Send Msg
NEW_Alert: Wait Msg
NEW_Alert: Replied Msg 0x23d17680
NEW_Alert: continue
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: DownloadFile causes problems when it's redirected to HTT

Post by airsoftsoftwair »

Code: Select all

- Fix: Memory freed twice when a URL passed to DownloadFile() redirected to a URL that used an
  unsupported protocol like HTTPS
Post Reply