{"action":"created","issue":{"url":"https://api.github.com/repos/esp8266/Arduino/issues/813","labels_url":"https://api.github.com/repos/esp8266/Arduino/issues/813/labels{/name}","comments_url":"https://api.github.com/repos/esp8266/Arduino/issues/813/comments","events_url":"https://api.github.com/repos/esp8266/Arduino/issues/813/events","html_url":"https://github.com/esp8266/Arduino/issues/813","id":107986166,"number":813,"title":"WifiClientSecure produce crash when used with client.available() and client.read().","user":{"login":"martinayotte","id":9724344,"avatar_url":"https://avatars.githubusercontent.com/u/9724344?v=3","gravatar_id":"","url":"https://api.github.com/users/martinayotte","html_url":"https://github.com/martinayotte","followers_url":"https://api.github.com/users/martinayotte/followers","following_url":"https://api.github.com/users/martinayotte/following{/other_user}","gists_url":"https://api.github.com/users/martinayotte/gists{/gist_id}","starred_url":"https://api.github.com/users/martinayotte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martinayotte/subscriptions","organizations_url":"https://api.github.com/users/martinayotte/orgs","repos_url":"https://api.github.com/users/martinayotte/repos","events_url":"https://api.github.com/users/martinayotte/events{/privacy}","received_events_url":"https://api.github.com/users/martinayotte/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-09-23T19:08:09Z","updated_at":"2015-09-24T15:20:02Z","closed_at":null,"body":"The following code is working fine, although it seems that there is a delay between header and body : \r\n\r\n    while (client.connected()) {\r\n      String line = client.readStringUntil('\\r');\r\n      p.println(line);\r\n    }\r\n\r\nBut if it is replaced by the following code, it produce a crash : \r\n\r\n    while (client.connected()) {\r\n      while ((size = client.available()) > 0) {\r\n        uint8_t* msg = (uint8_t*)malloc(size);\r\n        size = client.read(msg, size);\r\n        p.write(msg, size);\r\n        free(msg);\r\n      }\r\n    }\r\n\r\nThe stack trace look like : \r\n\r\nException (9):\r\nepc1=0x4010177f epc2=0x00000000 epc3=0x00000000 excvaddr=0x3fff596b depc=0x00000000\r\n\r\nctx: cont \r\nsp: 3ffecea0 end: 3ffed4c0 offset: 01a0\r\n\r\n>>>stack>>>\r\n3ffed040:  4020e1e5 00000001 3fff57c8 4020eb96  \r\n3ffed050:  00000000 3ffeb804 00000001 40203db9  \r\n3ffed060:  3fff57c8 00000005 00000005 00000000  \r\n3ffed070:  00000000 3fff5a10 00000000 00000000  \r\n3ffed080:  00000000 00000000 00000000 00000000  \r\n3ffed090:  00000000 00000000 00000000 00000000  \r\n3ffed0a0:  00000000 00000000 00000000 00000000  \r\n3ffed0b0:  00000000 00000000 00000000 00000000  \r\n3ffed0c0:  00000000 00000000 00000000 00000000  \r\n3ffed0d0:  00000000 00000000 00000000 00000000  \r\n3ffed0e0:  00000000 00000000 00000000 00000000  \r\n3ffed0f0:  00000000 00000000 00000000 00000000  \r\n3ffed100:  00000000 00000000 00000000 00000000  \r\n3ffed110:  00000000 00000000 00000000 00000000  \r\n3ffed120:  00000000 00000000 000 0000 00000000  \r\n3ffed130:  00000000 00000000 00000000 00000000  \r\n3ffed140:  00000000 00000000 00000000 00000000  \r\n3ffed150:  00000000 00000000 00000000 00000000  \r\n3ffed160:  00000000 00000000 00000000 00000000  \r\n3ffed170:  00000000 00000000 00000000 00000000  \r\n3ffed180:  00000000 00000000 00000000 00000000  \r\n3ffed190:  00000000 00000000 00000000 00000000  \r\n3ffed1a0:  00000000 00000000 00000000 00000000  \r\n3ffed1b0:  00000000 00000000 00000000 00000000  \r\n3ffed1c0:  00000000 00000000 0000001f 401015c9  \r\n3ffed1d0:  4000050c 00000000 00000000 00000000  \r\n3ffed1e0:  40002eee 00000030 0000001f ffffffff  \r\n3ffed1f0:  40002ef1 05e03079 00000013 00000490  \r\n3ffed200:  00000007 00000762 00400762 60000a00  \r\n3ffed210:  01280062 00000076 ffffff83 00000640  \r\n3ffed220:  05e02be9 00000064 00000063 00000030  \r\n3ffed230:  00000000 00000000 00000000 00000000  \r\n3ffed240:  00000000 00000000 00000000 00000000  \r\n3ffed250:  00000000 00000000 00000000 00000000  \r\n3ffed260:  00000000 00000000 00000000 00000000  \r\n3ffed270:  00000000 00000000 00000000 00000000  \r\n3ffed280:  00000000 00000000 00000000 00000000  \r\n3ffed290:  00000008 00000000 00000020 40103faf  \r\n3ffed2a0:  40103c6d 00000002 00000000 00000000  \r\n3ffed2b0:  3ffedfe0 40103b56 00000001 00000000  \r\n3ffed2c0:  00000000 40103927 00000000 3ffedfb0  \r\n3ffed2d0:  00000005 00000000 00000020 40103faf  \r\n3ffed2e0:  4010383b 3fff1ea0 3ffedfb0 40103faf  \r\n3ffed2f0:  40104b99 3fff1ea0 3ffedfe0 40103faf  \r\n3ffed300:  00000065 037bc951 3fff32d8 40104d28  \r\n3ffed310:  3ffeec6c 00000000 00000000 3ffeec6c  \r\n3ffed320:  4010293e 00040000 00000000 7fffffff  \r\n3ffed330:  00000022 4010293b 00040000 00000001  \r\n3ffed340:  3ffedfe0 4010509a 40105142 00000100  \r\n3ffed350:  00000000 037bc951 00000000 3ffeec84  \r\n3ffed360:  4000050c 3fffc278 40104ef4 3fffc200  \r\n3ffed370:  00000022 4010293b 00040000 3ffeec60  \r\n3ffed380:  40000f83 00000030 0000001e ffffffff  \r\n3ffed390:  40000ea3 00000023 00000001 00200000  \r\n3ffed3a0:  3fffdab0 00000000 3fffdb20 3ffed4ec  \r\n3ffed3b0:  00000000 00000000 00000001 3ffed4e4  \r\n3ffed3c0:  00000000 3fffdc20 3ffed4ec 00000030  \r\n3ffed3d0:  40201c15 3ffec4a0 40201ccc 00000000  \r\n3ffed3e0:  00000000 00000000 00000000 ffdfffff  \r\n3ffed3f0:  ffffffff 3fffc6fc 00000001 3ffec4a0  \r\n3ffed400:  00000000 3fffdc20 3ffed4ec 00000030  \r\n3ffed410:  3ffec46c 00000001 3ffe9fd4 4020f178  \r\n3ffed420:  3ffec46c 00000012 3ffe9ea1 3ffed4ec  \r\n3ffed430:  3ffec46c 00000013 3ffec46c 4020a4f9  \r\n3ffed440:  3ffe9fd3 3ffec1b8 3ffec46c 4020a4f9  \r\n3ffed450:  3ffe9e8f 40207226 3ffec46c 4020f24c  \r\n3ffed460:  3ffec46c 3fff5977 00000005 00000005  \r\n3ffed470:  3fff41a0 3ffec1b8 3ffeb834 402032e8  \r\n3ffed480:  00000000 00000000 00000016 40101dc1  \r\n3ffed490:  40201c8d 0104a8c0 00000000 3ffed4ec  \r\n3ffed4a0:  3fffdc20 00000000 3ffed4e4 40201cea  \r\n3ffed4b0:  00000000 00000000 3ffec4a0 40100398  \r\n<<<stack<<<\r\n\r\n ets Jan  8 2013,rst cause:1, boot mode:(3,7)\r\n\r\nload 0x4010f000, len 1264, room 16 \r\ntail 0\r\nchksum 0x42\r\ncsum 0x42\r\n~ld\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/esp8266/Arduino/issues/comments/142960603","html_url":"https://github.com/esp8266/Arduino/issues/813#issuecomment-142960603","issue_url":"https://api.github.com/repos/esp8266/Arduino/issues/813","id":142960603,"user":{"login":"martinayotte","id":9724344,"avatar_url":"https://avatars.githubusercontent.com/u/9724344?v=3","gravatar_id":"","url":"https://api.github.com/users/martinayotte","html_url":"https://github.com/martinayotte","followers_url":"https://api.github.com/users/martinayotte/followers","following_url":"https://api.github.com/users/martinayotte/following{/other_user}","gists_url":"https://api.github.com/users/martinayotte/gists{/gist_id}","starred_url":"https://api.github.com/users/martinayotte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martinayotte/subscriptions","organizations_url":"https://api.github.com/users/martinayotte/orgs","repos_url":"https://api.github.com/users/martinayotte/repos","events_url":"https://api.github.com/users/martinayotte/events{/privacy}","received_events_url":"https://api.github.com/users/martinayotte/received_events","type":"User","site_admin":false},"created_at":"2015-09-24T15:20:02Z","updated_at":"2015-09-24T15:20:02Z","body":"It is mentioned above : `<vPortFree>`"}}